You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

3.5 KiB

Compose Multiplatform Application

Сan run on desktop, Android and iOS. Note that iOS target is experimental so far.

Desktop

This template contains desktopApp run configuration that you can use to run the desktop target in Android Studio or Intellij IDEA.

Useful Gradle tasks:

  • ./gradlew run - run application
  • ./gradlew package - package native distribution into build/compose/binaries

Android

To run on Android, use androidApp run configuration in Android Studio or use Gradle:

./gradlew installDebug - install Android application on an Android device (on a real device or on an emulator)

iOS

To work with the iOS target you need:

Before trying to open the project in Android Studio, make sure that you have a correct environment for iOS development. Try to follow official Apple tutorials how to create a sample project in Xcode and register a simulator or a real device there.

Running on an iOS simulator

If you have a correct environment, Android Studio will show available iOS simulators on which you can run the application in iosApp run configuration.

Running on a real iOS device

To run on a real iOS device you need:

  • Team ID
  • set this Team ID in iosApp/Configuration/Config.xcconfig in the TEAM_ID field
  • the registered iOS device in Xcode

After that you can open the project in Android Studio, and it will show the registered iOS device in iosApp run configuration.

Hint: If you use a free Personal Team for signing applications to run on a real device, and you do not have access to the link above to know your Team ID, you may still find your Team ID value, using the following workaround:

  • manage to run a sample iOS project in XCode on a real iOS device
  • open XCode project in a text editor and search DEVELOPMENT_TEAM substring in it
  • the value of DEVELOPMENT_TEAM property is your personal Team ID

Configuring the iOS application

This template contains iosApp/Configuration/Config.xcconfig that allows you to configure the most basic properties, without using Xcode. It contains:

Note, that to configure the APP_NAME setting, you should open Config.xcconfig in any text editor before opening the project in Android Studio and correct respective value.

If you need to change this setting after you open the project in Android Studio, please do the following:

  • close the project in Android Studio
  • run ./cleanup.sh script in a terminal
  • correct the setting
  • open the project in Android Studio again

To configure advanced settings you need to use Xcode. Open iosApp/iosApp.xcworkspace in Xcode after opening the project in Android Studio.