kmm-a-multiplatform-adventure
kmm-a-multiplatform-adventure copied to clipboard
Build failure
For some reason, the build fails if iOS code is uncommented in build.gradle.
> Task :shared:cinteropFirebaseFirestoreIos
Exception in thread "main" java.lang.Error: /var/folders/_x/sj21vdjs1jg4svdb95fkppdh0000gn/T/tmp9066532793867170421.m:1:9: fatal error: module 'FirebaseFirestore' not found
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:67)
at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:13)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:499)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:264)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:72)
at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:37)
> Task :shared:cinteropFirebaseFirestoreIos FAILED
FAILURE: Build failed with an exception.
-
Android Studio 4.0.2 Build #AI-193.6911.18.40.6821437, built on September 9, 2020 Runtime version: 1.8.0_242-release-1644-b3-6222593 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.15.7
-
With commented parts of the iOS code the build is passing.
-
I do have Xcode installed: Version 12.0.1 (12A7300)
Helo @rtokun ,
This seems to be a problem with the KMM plugin.
Can you please try:
- Disable the KMM plugin/ restart Android Studio/ enable the plugin again and check if it's now working?
Did as you asked - same error. It is important to note that this error occurred after an upgrade of Android Studio.
I've been trying to replicate this on 4.0.1 and 4.0.2 and now on 4.1 and it seems to work.
Which jdk are you using? Can you try to use the 1.8 for instance?
The JDK on my machine is 1.8.0_202
It is important to note, that while I am creating the default "Hello World" project, it compiles and runs on both Android and iOS without any issues.
That might be because we're using a lot more things here than on hello world 🙂.
Just to confirm @rtokun, if you go to:
- Module Settings > SDK Location > JDK location you're using the 1.8.0_202 or the one bundled with Android Studio?
I even upgraded to java 271 build. You can see the complete error coming from right java version:
> Task :shared:cinteropFirebaseFirestoreIos FAILED
Execution failed for task ':shared:cinteropFirebaseFirestoreIos'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
I had the same issue. After syncing gradle again with the --stacktrace --debug
flags it looks like the error is:
fatal error: module 'FirebaseFirestore' not found
I tried doing pod install
inside the iosApp
and also reinstalled the KMM plugin, but I still have the same error.
KMM Version: 0.1.3-release-54-Studio4.1 Gradle Version: 6.3 Android Studio 4.1 Build #AI-201.8743.12.41.6858069, built on September 23, 2020 Runtime version: 1.8.0_242-release-1644-b3-6222593 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.15.7 GC: ParNew, ConcurrentMarkSweep Memory: 1979M Cores: 12 Registry: ide.new.welcome.screen.force=true Non-Bundled Plugins: idea.plugin.protoeditor, org.jetbrains.kotlin, com.jetbrains.kmm, Dart, io.flutter
I've found an answer here: https://stackoverflow.com/questions/60126503/how-to-add-thirdparty-ios-pod-library-into-kotlin-native-project-getting-error
Now I just can't build the project and run on emulator from Android Studio, but it runs from XCode. The project is building and running fine (Both Android and iOS).
I tried to change the iosApp configuration but the "Xcode project scheme" keep changing to "abseil" instead of "iosApp". Even if I create another Run/Debug configuration
I'm using:
Android Studio 4.1.1 Build #AI-201.8743.12.41.6953283, built on November 4, 2020 Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.16 GC: ParNew, ConcurrentMarkSweep Memory: 2014M Cores: 4 Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true Non-Bundled Plugins: com.linsage, org.jetbrains.kotlin, net.vektah.codeglance, com.jetbrains.kmm, drawable.importer.pluginId.7658.hack', Dart, io.flutter, wu.seal.tool.jsontokotlin
Oops, I didn't saw that previous message.
I believe that's because of step 2 on that StackOverflow link @xPryds.
Running the podspec
generates the shared module that's going to be used on the XCode project.
However, it seems that you're not able to generate it from Android Studio.
Can you attach the logs, please?
Hi @cmota.
The app is building but not installing in iOS via Android Studio. Nothing wrong with build logs, I guess.
3:50 PM Executing tasks: [podspec] in project /Users/pryds/git_buildone/kmm-base/06. Final Project/shared
3:50 PM Gradle build finished in 1 s 861 ms
3:51 PM Executing tasks: [:androidApp:assembleDebug] in project /Users/pryds/git_buildone/kmm-base/06. Final Project
3:51 PM Gradle build finished in 2 s 992 ms
3:51 PM Success: Operation succeeded
3:55 PM Build iOS application finished in 4 m 4 s
After build properly, I tried to make some changes, like creating a new activity but, during development, I still getting this error:
Exception in thread "main" java.lang.Error: /var/folders/j_/09x5w_bs0374vw52drdg41rm0000gn/T/tmp7504127051563406858.m:1:9: fatal error: module 'FirebaseFirestore' not found at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152) at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:67) at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:13) at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:499) at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:264) at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:72) at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45) at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19) at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:37)
Execution failed for task ':shared:cinteropFirebaseFirestoreIos'.
Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1