Closed kyadalu1 closed 10 months ago
Use Java 17
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
Nah same issue
I face similar issue when i don't use coroutines but i add some third party library to my android library. I try to add the biometric androdi x library, and when i call it from Godot i get issue
FATAL EXCEPTION: main
Process: com.example.mygame, PID: 11183
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/biometric/BiometricManager;
at com.example.androidlibrary.GodotAndroidPlugin.authenticate$lambda$4$lambda$3(GodotAndroidPlugin.kt:70)
at com.example.androidlibrary.GodotAndroidPlugin.$r8$lambda$EAioTuHWHUp3Q45fI013PsNpbY8(Unknown Source:0)
at com.example.androidlibrary.GodotAndroidPlugin$$ExternalSyntheticLambda1.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.biometric.BiometricManager" on path: DexPathList[[zip file "/data/app/~~c2LDRqR1AK6x59f8Ur7Qkg==/com.example.mygame-TIC2DKBf9zoKLE_L0YlphQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~c2LDRqR1AK6x59f8Ur7Qkg==/com.example.mygame-TIC2DKBf9zoKLE_L0YlphQ==/lib/arm, /data/app/~~c2LDRqR1AK6x59f8Ur7Qkg==/com.example.mygame-TIC2DKBf9zoKLE_L0YlphQ==/base.apk!/lib/armeabi-v7a, /system/lib, /system/system_ext/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.example.androidlibrary.GodotAndroidPlugin.authenticate$lambda$4$lambda$3(GodotAndroidPlugin.kt:70)
at com.example.androidlibrary.GodotAndroidPlugin.$r8$lambda$EAioTuHWHUp3Q45fI013PsNpbY8(Unknown Source:0)
at com.example.androidlibrary.GodotAndroidPlugin$$ExternalSyntheticLambda1.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
@kyadalu1 I provided an answer in https://github.com/godotengine/godot/issues/86152#issuecomment-1865273113; Kotlin coroutines are a separate dependency so you need to include that dependency to avoid ClassNotFoundException
exception errors.
See https://developer.android.com/kotlin/coroutines#dependency for more details.
I am trying to use Kotlin's coroutine in my android library for Godot. Below is the complete error message
Here is the my android library repo and here is the Godot repo
My code crashes when i try to use below code in my android library
private val serviceScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
I am using
kotlin 1.9.10
which contain coroutines internally and i have not added any coroutines dependencies externally