InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
8.81k stars 700 forks source link

release NoClassDefFoundError,debug is fine #1906

Open LeonShannon opened 2 weeks ago

LeonShannon commented 2 weeks ago

Describe the bug Launch in release mode, debug is fine gradle 8.5 does not work, 8.3.2 does

Log java.lang.NoClassDefFoundError: Failed resolution of: Lcom/vgjump/jump/ui/main/MainConfigViewModel; at com.vgjump.jump.config.P0.q1(SourceFile:25) at com.vgjump.jump.config.P0.l(SourceFile:1) at com.vgjump.jump.config.M0.invoke(SourceFile:1) at org.koin.dsl.ModuleDSLKt.module(SourceFile:4) at org.koin.dsl.ModuleDSLKt.module$default(SourceFile:2) at com.vgjump.jump.config.P0.<clinit>(SourceFile:9) at com.vgjump.jump.App.J(SourceFile:14) at com.vgjump.jump.App.e(SourceFile:1) at com.vgjump.jump.b.invoke(SourceFile:1) at org.koin.core.context.GlobalContext.startKoin(SourceFile:8) at org.koin.core.context.DefaultContextExtKt.startKoin(SourceFile:2) at com.vgjump.jump.App.onCreate(SourceFile:73) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7711) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8919) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) Caused by: java.lang.ClassNotFoundException: com.vgjump.jump.ui.main.MainConfigViewModel at com.vgjump.jump.config.P0.q1(SourceFile:25)  at com.vgjump.jump.config.P0.l(SourceFile:1)  at com.vgjump.jump.config.M0.invoke(SourceFile:1)  at org.koin.dsl.ModuleDSLKt.module(SourceFile:4)  at org.koin.dsl.ModuleDSLKt.module$default(SourceFile:2)  at com.vgjump.jump.config.P0.<clinit>(SourceFile:9)  at com.vgjump.jump.App.J(SourceFile:14)  at com.vgjump.jump.App.e(SourceFile:1)  at com.vgjump.jump.b.invoke(SourceFile:1)  at org.koin.core.context.GlobalContext.startKoin(SourceFile:8)  at org.koin.core.context.DefaultContextExtKt.startKoin(SourceFile:2)  at com.vgjump.jump.App.onCreate(SourceFile:73)  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7711)  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loopOnce(Looper.java:230)  at android.os.Looper.loop(Looper.java:319)  at android.app.ActivityThread.main(ActivityThread.java:8919)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) 

proguard -keep class org.koin.core.** { *; } -keep interface org.koin.core.** { *; } -keepclassmembers class * { public <init>(...); } -keep class org.koin.** { *; } -keep class org.koin.core.** { *; } -keep class org.koin.dsl.** { *; }

Koin module and version: koin-android = { module = "io.insert-koin:koin-android", version = "3.5.6" } koin-ktor = { module = "io.insert-koin:koin-ktor", version = "3.5.6" }

Snippet or Sample project to help reproduce Add a snippet or even a small sample project to hel reproduce your case.

image

LeonShannon commented 2 weeks ago

does not work android.enableR8.fullMode=false

MReP1 commented 2 weeks ago

It is not a issue of koin, set Library module build.gradle release isMinifyEnabled to false will be fine.

HoseinSadonasl commented 3 days ago

I have the same problem. Is there any news?