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:
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)
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 theapi(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.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
.