java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/coroutines/experimental/CompletableDeferredKt
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/coroutines/experimental/CompletableDeferredKt
我的应用程序运行良好,直到我按照说明添加 kotlin 协程 here . When I click a floating button to open another activity from this lib 我收到此错误。删除协程后应用程序工作正常。
我已经尝试了很多解决方案,例如:
- 禁用即时 运行。
- 清理并重建
- 将 minifyEnabled false 添加到调试 buildType。
- 添加 multiDex
但是 none 有效。
android {
compileSdkVersion 28
defaultConfig {
...
minSdkVersion 17
targetSdkVersion 28
multiDexEnabled true
...
}
}
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
implementation "org.jetbrains.anko:anko:$anko_version"
implementation "org.jetbrains.anko:anko-design:$anko_version"
implementation 'com.fxn769:pix:1.2.5'
implementation 'com.android.support:multidex:1.0.3'
....
}
痕迹
2019-02-18 10:01:10.097 9523-9523/com.APPIDHERE E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.APPIDHERE, PID: 9523
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/coroutines/experimental/CompletableDeferredKt;
at io.fotoapparat.hardware.CameraDevice.<init>(CameraDevice.kt:48)
at io.fotoapparat.hardware.Device.<init>(Device.kt:39)
at io.fotoapparat.hardware.Device.<init>(Device.kt:34)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:55)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:48)
at io.fotoapparat.FotoapparatBuilder.buildInternal(FotoapparatBuilder.kt:190)
at io.fotoapparat.FotoapparatBuilder.build(FotoapparatBuilder.kt:179)
at com.fxn.pix.Pix.initialize(Pix.java:373)
at com.fxn.pix.Pix.onCreate(Pix.java:325)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
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)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlinx.coroutines.experimental.CompletableDeferredKt" on path: DexPathList[[zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/base.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_resources_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at io.fotoapparat.hardware.CameraDevice.<init>(CameraDevice.kt:48)
at io.fotoapparat.hardware.Device.<init>(Device.kt:39)
at io.fotoapparat.hardware.Device.<init>(Device.kt:34)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:55)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:48)
at io.fotoapparat.FotoapparatBuilder.buildInternal(FotoapparatBuilder.kt:190)
at io.fotoapparat.FotoapparatBuilder.build(FotoapparatBuilder.kt:179)
at com.fxn.pix.Pix.initialize(Pix.java:373)
at com.fxn.pix.Pix.onCreate(Pix.java:325)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
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)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
2019-02-18 10:01:10.097 9523-9523/com.APPIDHERE E/AndroidRuntime: at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
at android.app.ActivityThread.access00(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
... 6 more
PixImagePicker
所依赖的 Fotoapparat
的旧版本中使用了实验协程。参见 here
虽然 Fotoapparat
已经更新,所以它不再使用这些,而且 PixImagePicker
似乎也在使用最新版本的 Fotoapparat
。
也许可以在 Github 上向他们提出问题。
我的应用程序运行良好,直到我按照说明添加 kotlin 协程 here . When I click a floating button to open another activity from this lib 我收到此错误。删除协程后应用程序工作正常。
我已经尝试了很多解决方案,例如:
- 禁用即时 运行。
- 清理并重建
- 将 minifyEnabled false 添加到调试 buildType。
- 添加 multiDex
但是 none 有效。
android {
compileSdkVersion 28
defaultConfig {
...
minSdkVersion 17
targetSdkVersion 28
multiDexEnabled true
...
}
}
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
implementation "org.jetbrains.anko:anko:$anko_version"
implementation "org.jetbrains.anko:anko-design:$anko_version"
implementation 'com.fxn769:pix:1.2.5'
implementation 'com.android.support:multidex:1.0.3'
....
}
痕迹
2019-02-18 10:01:10.097 9523-9523/com.APPIDHERE E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.APPIDHERE, PID: 9523
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/coroutines/experimental/CompletableDeferredKt;
at io.fotoapparat.hardware.CameraDevice.<init>(CameraDevice.kt:48)
at io.fotoapparat.hardware.Device.<init>(Device.kt:39)
at io.fotoapparat.hardware.Device.<init>(Device.kt:34)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:55)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:48)
at io.fotoapparat.FotoapparatBuilder.buildInternal(FotoapparatBuilder.kt:190)
at io.fotoapparat.FotoapparatBuilder.build(FotoapparatBuilder.kt:179)
at com.fxn.pix.Pix.initialize(Pix.java:373)
at com.fxn.pix.Pix.onCreate(Pix.java:325)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
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)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlinx.coroutines.experimental.CompletableDeferredKt" on path: DexPathList[[zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/base.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_resources_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at io.fotoapparat.hardware.CameraDevice.<init>(CameraDevice.kt:48)
at io.fotoapparat.hardware.Device.<init>(Device.kt:39)
at io.fotoapparat.hardware.Device.<init>(Device.kt:34)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:55)
at io.fotoapparat.Fotoapparat.<init>(Fotoapparat.kt:48)
at io.fotoapparat.FotoapparatBuilder.buildInternal(FotoapparatBuilder.kt:190)
at io.fotoapparat.FotoapparatBuilder.build(FotoapparatBuilder.kt:179)
at com.fxn.pix.Pix.initialize(Pix.java:373)
at com.fxn.pix.Pix.onCreate(Pix.java:325)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
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)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.APPIDHERE-EfujhYqtoKYpsUMLZOt1TQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
2019-02-18 10:01:10.097 9523-9523/com.APPIDHERE E/AndroidRuntime: at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
at android.app.ActivityThread.access00(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
... 6 more
PixImagePicker
所依赖的 Fotoapparat
的旧版本中使用了实验协程。参见 here
虽然 Fotoapparat
已经更新,所以它不再使用这些,而且 PixImagePicker
似乎也在使用最新版本的 Fotoapparat
。
也许可以在 Github 上向他们提出问题。