Skip to content

udacity/cd0638-Cross-Platform-Development-Android-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Conference IO Demo - Starter Code

This is the starter code for a Kotlin Multiplatform project targeting Android and iOS platforms. This repository provides the foundational project structure and basic domain models to get started building a conference management application.

What's Included

This starter code provides:

  • Project Structure: Pre-configured Kotlin Multiplatform modules (composeApp, shared, iosApp)
  • Domain Models: Basic Session and Speaker data classes with kotlinx.serialization
  • Platform Setup: Android and iOS application entry points configured
  • Build Configuration: Gradle build scripts with Compose Multiplatform dependencies
  • Package Structure: Organized using com.droidcon.global namespace

πŸ› οΈ Prerequisites & Environment Setup

Before you clone & run this starter code, you must ensure your development environment is set up correctly for Kotlin Multiplatform (KMP) development.

KMP requires tooling from both the Android and Apple ecosystems to compile native apps for both platforms.

⚠️ Critical Hardware Requirement: To build and run the iOS application, you must be using a Macintosh computer running macOS. Windows and Linux users will only be able to build and run the Android application.

Please complete the following steps in order to configure your machine.

Step 1: Install Xcode (macOS Only)

To compile the iOS app, you need Apple's official development environment.

  1. Download Xcode: Install the latest stable version of Xcode from the Mac App Store. Note: This is a large download.

  2. Accept License & Install Components: Once installed, open Xcode at least once. It will prompt you to install additional components and accept the license agreement. You must agree to proceed.

  3. Install Command Line Tools: Open your terminal and run the following command to install necessary build tools:

    xcode-select --install
  4. Download Simulator Runtime: In Xcode, go to Settings > Platforms and ensure you have downloaded at least one iOS Simulator runtime (e.g., iOS 17.x).

Step 2: Install Android Studio (All OS)

Android Studio is the primary IDE we will use for writing code on both platforms.

  1. Download: Download and install the latest stable version of Android Studio from the official website.

  2. Setup Wizard: During the initial setup wizard, ensure the following components are checked for installation:

    • Android SDK
    • Android SDK Platform
    • Android Virtual Device (AVD)
  3. Verify SDK: Open Android Studio, go to Settings/Preferences > Languages & Frameworks > Android SDK, and ensure the "Android SDK Command-line Tools" are installed under the "SDK Tools" tab.

Step 3: The Final Check - KDoctor (macOS Only)

To ensure all the complex moving parts between Java, Android, and Xcode are configured correctly, we use a diagnostic tool from JetBrains called KDoctor.

  1. Install KDoctor via Homebrew by running this command in your terminal:

    brew install kdoctor
  2. Run Diagnostics: Run the tool by typing:

    kdoctor

Your Goal: KDoctor should output green checkmarks [v] next to the following sections:

  • [v] System
  • [v] Java
  • [v] Android Studio
  • [v] Xcode

If you see any red failures [x], KDoctor will provide specific commands to fix them. Run those commands and rerun kdoctor until everything is green.

(Note: You may ignore warnings regarding CocoaPods if they appear, as this project does not heavily rely on them.)


βœ… Once your environment is set up, you are ready to clone this repository and open it in Android Studio!

Project Requirements

  • Android Minimum SDK: API 24 (Android 7.0)
  • Android Compile SDK: As defined in gradle/libs.versions.toml
  • macOS Version: Version 12.0 (Monterey) or later (for iOS development)
  • iOS Deployment Target: As configured in the Xcode project

Project Structure

ConferenceIODemo/
β”œβ”€β”€ composeApp/              # Compose Multiplatform application module
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ androidMain/     # Android-specific implementations
β”‚   β”‚   β”œβ”€β”€ commonMain/      # Shared UI and business logic
β”‚   β”‚   β”œβ”€β”€ iosMain/         # iOS-specific implementations
β”‚   β”‚   └── commonTest/      # Shared unit tests
β”‚   └── build.gradle.kts     # App module build configuration
β”‚
β”œβ”€β”€ shared/                  # Shared business logic module
β”‚   └── src/
β”‚       β”œβ”€β”€ commonMain/      # Domain models and common code
β”‚       └── androidMain/     # Android-specific shared code
β”‚
β”œβ”€β”€ iosApp/                  # iOS application entry point
β”‚   └── iosApp/             # SwiftUI app code and Xcode project
β”‚
β”œβ”€β”€ gradle/                  # Gradle wrapper and version catalog
β”œβ”€β”€ build.gradle.kts         # Root build configuration
└── settings.gradle.kts      # Project settings

Included Domain Models

Located in shared/src/commonMain/kotlin/com/droidcon/global/domain/model/:

Session.kt

data class Session(
    val id: String,
    val title: String,
    val description: String,
    val startTime: String,
    val endTime: String,
    val room: String,
    val speakerId: String,
    val isServiceSession: Boolean
)

Speaker.kt

data class Speaker(
    val id: String,
    val name: String,
    val bio: String,
    val avatar: String,
    val company: String,
    val sessionId: String
)

Both models are annotated with @Serializable for kotlinx.serialization support.

Getting Started

Clone the Repository

git clone https://github.com/kshitizbali/Udacity-Demo-Project.git
cd ConferenceIODemo

Build and Run Android Application

Using Android Studio:

  1. Open the project in Android Studio
  2. Wait for Gradle sync to complete
  3. Select the composeApp run configuration
  4. Click the Run button or press Shift + F10

Using Command Line:

  • On macOS/Linux:

    ./gradlew :composeApp:assembleDebug
  • On Windows:

    .\gradlew.bat :composeApp:assembleDebug

To install on a connected device or emulator:

./gradlew :composeApp:installDebug

Build and Run iOS Application

Prerequisites: Must be on macOS with Xcode installed

Using Android Studio:

  1. Select the iosApp run configuration
  2. Choose an iOS Simulator
  3. Click the Run button

Using Xcode:

  1. Open the iosApp directory in Xcode:
    open iosApp/iosApp.xcodeproj
  2. Select a simulator or connected iOS device
  3. Click the Run button or press Cmd + R

Next Steps

This starter code provides the foundation. You can now:

  1. Implement API integration to fetch sessions and speakers
  2. Create UI screens to display conference data
  3. Add navigation between screens
  4. Implement state management
  5. Add error handling and loading states
  6. Customize the UI theme and styling

API Endpoints (For Reference)

The following mock APIs are available for development:

  • Sessions API: https://694e2d80b5bc648a93bf8dd0.mockapi.io/api/v1/sessions
  • Speakers API: https://694e2d80b5bc648a93bf8dd0.mockapi.io/api/v1/sessions/:id/speakers

For detailed API response structures, see plan/api_response_updated.md

Package Structure

All code uses the com.droidcon.global namespace:

  • com.droidcon.global - Main application code and UI
  • com.droidcon.global.domain.model - Domain models (Session, Speaker)

Technology Stack

  • Kotlin Multiplatform: Shared code across platforms
  • Compose Multiplatform: Declarative UI framework
  • kotlinx.serialization: JSON serialization/deserialization
  • Gradle: Build system with Kotlin DSL
  • Material 3: Modern UI design system

Troubleshooting

Common Issues

  1. Gradle Sync Failed

    • Ensure you have a stable internet connection
    • Try: File β†’ Invalidate Caches β†’ Invalidate and Restart
    • Check that JDK 11+ is configured in Android Studio
  2. iOS Build Errors

    • Ensure Xcode Command Line Tools are installed: xcode-select --install
    • Clean build folder in Xcode: Product β†’ Clean Build Folder
    • Update CocoaPods: sudo gem update cocoapods
  3. Package Name Errors

    • Ensure all files use com.droidcon.global package namespace
    • Clean and rebuild: ./gradlew clean build

Learn More

About

Project starter code for cd0638, Cross-Platform Development and Advanced Android Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors