compose-multiplatform: Null pointer exception when building IOS `MainViewController` with simple `App` implementation

Describe the bug When building, the MainViewController for iOS encounters a null pointer exception when attempting to construct an App instance.

Affected platforms iOS

Versions #Versions My OS: Mac OS Ventura (M1 macbook air)

Target iOS versions: iOS 14.1 Target JVM toolchain: 11

#Android android.useAndroidX=true android.compileSdk=33 android.targetSdk=33 android.minSdk=24

Other

kotlin.version=1.9.0 agp.version=8.1.0 compose.version=1.5.0-beta01 (I also got the exception with 1.4.1 and 1.4.3)

To Reproduce Not sure

Expected behavior Successful build (hopefully!)

Screenshots My code: Screenshot 2023-07-30 at 5 03 48 PM

Additional context Full stack trace: npe_error_log.txt

The iOS build has two dependencies: SqlDelight and an xcframework stored locally and configured with cinterop.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 26 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Found this ticket by chance.

I was following Philipp Lackner’s KMP tutorial. There he used SQLDelight 1.5 which I had to upgrade it to 2.x to work with my Android Studio - After a series of SQLDelight build issues, I ended up seeing this error. Obviously, SQLDelight triggered this issue.

I have tried all the suggestions above, and none works. Eventually the api(compose.runtime) trick made it builds on XCode but no luck building on Android Studio/gradlew command line. I am unsure if this should be classified as a CMP issue, or a SQLDelight issue - as it seems pretty sensitive to Kotlin versions (thus affecting the Compose compiler) and has been quite problematic.

Any fixes for this? I am running into this issue too.

I used realm sdk instead of sqldelight

@dima-avdeev-jb Yes, I run iOS with AndroidStudio and KMM plugin, I can just run ios without going through any changes with sample, this error I only run into when ./gradlew :shared:build.