Reputation: 20205
I want to add a Run/Debug Configuration for an iOS Application for a Kotlin Multiplatform Mobile application in Android Studio 4.1.2. However, there seems to be a problem with the configuration for iOS.
In the screenshot below you can see the problem. In the dialog "Run/Debug Configuration" Android Studio complains about
Error: Please specify Xcode project location in xcodeproj property of gradle.properties
Using the "Fix" button does not solve the problem. Android Studio just adds an additional xcodeproj
to gradle.properties
and the complains about a duplicate parameter.
I also tried different paths (relative and absolute) for xcodeproj
. No luck.
If I remember correctly, it used to work out of the box. A new Kotlin Multiplatform Mobile project was automatically configured for Android and iOS. I'm not sure what changed. Probably something was updated.
Is this a bug with the KMM plugin? Or is there something I can do on my system to fix this?
Upvotes: 16
Views: 8390
Reputation: 1281
Upgrading Android Studio version to 4.2.1, KMM plugin version to 0.2.6, creating new KMM project with KMM plugin, the problem can be fixed automatically.
Upvotes: 1
Reputation: 3978
If you don't wanna use Xcode:
Look like there is some IDE issues in this versions, one option would be to downgrade the Kotlin version.
What worked for me was to download the latest Canary Android Studio and setup my KMM project there.
Hopefully soon this will be stable for the next versions
Upvotes: 0
Reputation: 91
I fixed it by downgrading the Kotlin version from 1.4.30 to 1.4.21. You can check this thread here. To downgrade, download the version you want from the plugin store and choose the install plugin from disk as in the picture below
Upvotes: 3
Reputation: 449
If the project doesn't run right away even on opening it from Xcode and shows the shared framework is missing
, Then try generating the shared framework for iOS platform using terminal. Navigate to the project folder and execute
Command: ./gradlew packForXcode
Now the shared framework should have a xcode-frameworks
product and you should be able to build and run the project through Xcode.
Upvotes: 4
Reputation: 502
don't do that with Android Studio.
Just open Xcode, click on 'open another project...', locate to the iosApp
folder that named it when creating your project on Android Studio.
after that, just click run and have fun.
Upvotes: 6