Upgrading android gradle plugin to 8.0 and above enables R8 full mode by default. There is type erasure or code elimination in R8 full mode, that causes runtime exception.
Those lines from documentation are already in proguard config:
-keep, allowobfuscation, allowoptimization class org.kodein.type.TypeReference
-keep, allowobfuscation, allowoptimization class org.kodein.type.JVMAbstractTypeToken$Companion$WrappingTest
-keep, allowobfuscation, allowoptimization class * extends org.kodein.type.TypeReference
-keep, allowobfuscation, allowoptimization class * extends org.kodein.type.JVMAbstractTypeToken$Companion$WrappingTest
Exception is thrown on start of release build (optimized mode, with "-dontobfuscate" option in proguard config to get real stacktrace and ability to decompile app):
java.lang.ExceptionInInitializerError
at mypackage._ServiceModuleKt.<clinit>(SourceFile:1)
at mypackage._ApplicationModuleKt.<clinit>(SourceFile:1)
at mypackage.MyApplication.<init>(SourceFile:4)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newApplication(Instrumentation.java:1007)
at android.app.Instrumentation.newApplication(Instrumentation.java:992)
at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5335)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: korlibs.time.DateException: Binding IRepository must not override an existing binding.
at org.kodein.di.internal.DIContainerBuilderImpl.checkOverrides(SourceFile:83)
at org.kodein.di.internal.DIBuilderImpl$TypeBinder.with(SourceFile:27)
at mypackage.CallbackService$onOpenUpCallback$1.invoke(SourceFile:451)
at mypackage.CallbackService$onOpenUpCallback$1.invoke(SourceFile:324)
at org.kodein.di.internal.DIImpl.<init>(SourceFile:5)
at mypackage._RepositoryModuleKt.<clinit>(SourceFile:6)
... 16 more
Recent versions of Kodein transitively embed the proguard rules, so you don't need to add them anymore.
205 is not resolved, but answered. This error does not come from Kodein, but from R8 that shrink objects that then are not found by Kodein to bind them.
Upgrading android gradle plugin to 8.0 and above enables R8 full mode by default. There is type erasure or code elimination in R8 full mode, that causes runtime exception.
Those lines from documentation are already in proguard config:
Exception is thrown on start of release build (optimized mode, with "-dontobfuscate" option in proguard config to get real stacktrace and ability to decompile app):
Same issue #205 is closed, but not resolved