https://kotlinlang.org logo
Title
s

soderbjorn

04/18/2023, 10:19 PM
I tried the Compose multiplatform wizard by terrakok - loving the concept (I realise though it's not an official JB project, so perhaps this is the wrong place to ask). Has anyone successfully used it to run the iOS app though?
For me the iOS appears to consistently die immediately and never displays any UI. (I should mention that I can successfully run the iOS app from the official mobile multi-platform template.
"/Users/soderbjorn/Downloads/Compose-App/build/ios/Debug-iphonesimulator/Compose <http://App.app|App.app>"
Process finished with exit code 0
a

ayodele

04/18/2023, 10:24 PM
Is that all the error you are getting??
s

soderbjorn

04/18/2023, 10:28 PM
Yes, when running the iOS task from within Android Studio (using the mobile plugin) I very briefly (because project already built) see some build output which quickly vanishes to be replaces by the output above. Th iOS simulator runs but never displays anything.
a

ayodele

04/18/2023, 10:32 PM
Is there a reproducible project. I'm guessing it's related to compose.
a

Alejandro Rios

04/18/2023, 10:55 PM
CC @Konstantin Tskhovrebov (he is the author 😅)
s

soderbjorn

04/19/2023, 6:33 AM
I simply created a template with all of the platforms and most of the libraries marked. It is interesting that the official template works while the wizard-generated code does not, so it feels like it shouldn't be some fundamental environmental problem on my machine (or at least that would not be the only factor).
k

Konstantin Tskhovrebov

04/19/2023, 6:50 AM
Do you use latest kmm plugin? I guess your ios run configuration was generated with wrong schema. Just edit it. In latest kmm plugin i fixed the behaviour
s

soderbjorn

04/19/2023, 6:58 AM
Thanks for your reply! Hmm - I am running 0.5.3 (222) - 12 of the plugin, which appears to be the latest version. But I will try to compare the iOS configuration with the one from the official template and see if I can find a difference.
k

Konstantin Tskhovrebov

04/19/2023, 7:00 AM
Yes, i will check the wizard as well
s

soderbjorn

04/19/2023, 7:04 AM
Hmm -- the run configuration itself appears to be identical between the template project and the wizard generated project, at least from what can be determined by just looking in Android Studio at the run configuration dialog. When comparing the iOS folders between the two, there are various differences in various files, but I don't know enough (anything) about iOS development or XCode in order to determine what might be the cause or in which file to start looking.
k

Konstantin Tskhovrebov

04/19/2023, 7:10 AM
Could you share with me your broken project?
s

soderbjorn

04/19/2023, 7:12 AM
Absolutely. 🙂
k

Konstantin Tskhovrebov

04/19/2023, 7:52 AM
the project works fine on my side. so, it means there is some issue on your machine, i guess.
could you show
kdoctor -v
output
s

soderbjorn

04/19/2023, 8:47 AM
Here is output from kdoctor:
soderbjorn@soderbjorn-mac-m1work-2 compose-kmp-template % kdoctor -v
Environment diagnose:
[✓] Operation System
  ➤ Version OS: macOS 12.0.1
    CPU: Apple M1 Max

[✓] Java
  ➤ Java (openjdk version "13.0.9" 2021-10-19)
    Location: /Users/soderbjorn/Library/Java/JavaVirtualMachines/azul-13.0.9/Contents/Home/bin/java
  i JAVA_HOME is not set
    Consider adding the following to ~/.zprofile for setting JAVA_HOME
    export JAVA_HOME=/Users/soderbjorn/Library/Java/JavaVirtualMachines/azul-13.0.9/Contents/Home

[✓] Android Studio
  ➤ Android Studio (AI-222.4459.24.2221.9862592)
    Location: /Applications/Android <http://Studio.app|Studio.app>
    Bundled Java: openjdk 17.0.6 2023-01-17
    Kotlin Plugin: 222-1.8.0-release-AS3739.54
    Kotlin Multiplatform Mobile Plugin: 0.5.3(222)-12
  i Note that, by default, Android Studio uses bundled JDK for Gradle tasks execution.
    Gradle JDK can be configured in Android Studio Preferences under Build, Execution, Deployment -> Build Tools -> Gradle section

[✓] Xcode
  ➤ Xcode (13.4.1)
    Location: /Applications/Xcode.app
  i Xcode JAVA_HOME: /Users/soderbjorn/Library/Java/JavaVirtualMachines/azul-13.0.9/Contents/Home
    Xcode JAVA_HOME can be configured in Xcode -> Preferences -> Locations -> Custom Paths

[✓] Cocoapods
  ➤ ruby (ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21])
  ➤ ruby gems (3.3.7)
  ➤ cocoapods (1.12.0)

Recommendations:
  ➤ IDE doesn't suggest running all tests in file if it contains more than one class
    More details: <https://youtrack.jetbrains.com/issue/KTIJ-22078>
Conclusion:
  ✓ Your system is ready for Kotlin Multiplatform Mobile Development!
Also, I double checked again that the compose multiplatform template builds and runs fine, and it still does (attached here).
So, while it does appear to be something on our machines that differ (since you could load and run my wizard-generated project), there is some unknown factor at play as well since I can successfully run the multiplatform template by JB on the iOS simulator, but not the wizard-generated one.
k

Konstantin Tskhovrebov

04/19/2023, 1:11 PM
really interesting 🤔 let's take a look at
./gradlew linkPodDebugFrameworkIosSimulatorArm64 --info
in the broken project
BTW, I see that your build is successfull. but app just doesn't start on simulator
it can be related on simulator issue. try to delete the app from it and try to launch the app again from AS
s

soderbjorn

04/19/2023, 8:24 PM
Thanks for your support. Did not mean to waste your time on this. I appreciate all the effort you put into this wizard, I'm sure the cause must be something pretty silly. Anyway, here is the output from the (working) template build, and the (non-working) wizard build.
Regarding your idea to delete the app: As far as I can tell, the "wizard build" produces no app inside the iOS emulator... whereas when I do the "template build", it immediately installs an app whose icon is visible on the desktop. I've tried it multiple times with the same result.
Despite this, both gradle builds don't produce any obvious error. They both do produce a warning at the end ("w: Cannot infer a bundle ID from packages of source files and exported dependencies...") but that warning similar for both projects, despite the fact that one of them is failing (to install/run something) and one of them is not.
As far as I can tell, comparing the log output for these projects side by side, the most visible difference (among a myriad of small differences, of course) is that the "wizard build" in the beginning has lots of messages like these. I have no clue whether that has any significance though.
The configuration detachedConfiguration1 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these.
The configuration detachedConfiguration1 is both consumable and declarable. This combination is incorrect, only one of these flags should be set.