w: Runtime JAR files in the classpath should have the same version.
Closed this issue ยท 5 comments
Thanks for an awesome library ๐ .
Unfortunately straightforward integration (as described from the README) of this library into the android app project can cause really massive influence on the DEX method count limit.
For example: here is report from the dex-count-gradle-plugin built for for the app after adding ActivityStarter kotlin library
And whats more, compiler started to send such messages:
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
*/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.1.4-2/5d546e5fc95a44ff827425c8a756f5fdf94d79d2/kotlin-reflect-1.1.4-2.jar (version 1.1)
*/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.41/d0cfb3ef897c00449e5e696355db9506225fb507/kotlin-stdlib-jdk7-1.2.41.jar (version 1.2)
*/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.50/66d47b004c5b8a1d2d1df9e463187390ed741316/kotlin-stdlib-1.2.50.jar (version 1.2)
*/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.2.50/6b19a2fcc29d34878b3aab33fd5fcf70458a73df/kotlin-stdlib-common-1.2.50.jar (version 1.2)
w: Consider providing an explicit dependency on kotlin-reflect 1.2 to prevent strange errors
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
I found that this was caused by transitive kotlin-reflect
dependecy of activitystarter-kotlin.
To fix this you will need to mark activitystarter-kotlin dependencies as NOT transitive
Like:
implementation ("com.marcinmoskala.activitystarter:activitystarter-kotlin:1.11-beta") {
transitive = false
}
So I will recommend to add some note to the README about this situation to avoid confusion of the the library users.
Hope this was helpful :)
I believe I can make even better job by migrating to a newer gradle version which supports implementation
dependency.
@amatkivskiy Please, check out version "1.12-beta-2". I moved to the newest Gradle. It still requires some testing (especially in Java since I just have Kotlin projects), but it should help with your concern.
@MarcinMoskala Sorry for late response :(
Provided version fixes the issue ๐
@MarcinMoskala Unfortunately now I am facing issue with missing kotlin-reflect.jar
:
kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath
at kotlin.jvm.internal.CallableReference.getReflected(CallableReference.java:77)
at kotlin.jvm.internal.PropertyReference.getReflected(PropertyReference.java:25)
at kotlin.jvm.internal.MutablePropertyReference1.getGetter(MutablePropertyReference1.java:34)
at kotlin.jvm.internal.MutablePropertyReference1.getGetter(MutablePropertyReference1.java:13)
at com.marcinmoskala.activitystarter.BoundToArgValueDelegateProvider.provideDelegate(ArgExtra.kt:24)
at com.github.amatkivskiy.template.presentation.ui.details.UserDetailsActivity.<init>(UserDetailsActivity.kt:38)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
@MarcinMoskala seems marking dependencie's transitive = false
is the only solution :(