Failed to include Retrofit version > 2.6 in Project - android

I try to include Retrofit with Gson converter in my project.
Without the changes in the gradle file, everything works. When I add the dependencies
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.code.gson:gson:2.8.6'
to my gradle file, the project still compiles and even installs the app, but it crashes with this error:
2020-07-10 21:14:02.261 9083-9083/com.testproject.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.testproject.app, PID: 9083
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.testproject.app/com.testproject.app.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.testproject.app.MainActivity" on path: DexPathList[[zip file "/data/app/com.testproject.app-Au1uLD6rtjGrZa2PoCEKZA==/base.apk"],nativeLibraryDirectories=[/data/app/com.testproject.app-Au1uLD6rtjGrZa2PoCEKZA==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2718)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.testproject.app.MainActivity" on path: DexPathList[[zip file "/data/app/com.testproject.app-Au1uLD6rtjGrZa2PoCEKZA==/base.apk"],nativeLibraryDirectories=[/data/app/com.testproject.app-Au1uLD6rtjGrZa2PoCEKZA==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1173)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2708)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6541) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.testproject.app-Au1uLD6rtjGrZa2PoCEKZA==/base.apk because: Failure to verify dex file '/data/app/com.testproject.app-Au1uLD6rtjGrZa2PoCEKZA==/base.apk': Bad method handle type 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:676)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:709)
at android.app.LoadedApk.getResources(LoadedApk.java:936)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2242)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5672)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
... 6 more
Edit:
Found out that it works with Retrofit 2.6.0, but not with greater versions.

You only need the Square GSON dependency - remove the GSON dependency from Google. Should read like this:
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

Related

AGP 7.2 - java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_3570298/Offline; for instrumentation tests

When running android instrumentation tests with AGP 7.2 (android studio chipmunk) I am seeing the following error:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_b6258fc/Offline;
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.$jacocoInit(Unknown Source:13)
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.<clinit>(Unknown Source:0)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jacoco.agent.rt.internal_b6258fc.Offline" on path: DexPathList[[zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.abc.appname.develop.test-VAV8qDGNBpOvARX_Y9h_SA==/base.apk"],nativeLibraryDirectories=[/data/app/com.abc.appname.develop.test-VAV8qDGNBpOvARX_Y9h_SA==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.$jacocoInit(Unknown Source:13) 
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.<clinit>(Unknown Source:0) 
at java.lang.Class.newInstance(Native Method) 
at android.app.Instrumentation.newActivity(Instrumentation.java:1174) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
I have jacoco 0.8.8 setup as well, but when I turn debug.testCoverageEnabled to false, the instrumentation tests pass successfully.
Using jacoco 0.8.7 has the same issue, but both 0.8.7 and 0.8.8 work correctly on AGP 7.1.3 (bumblebee).

Unity 2019 - Android - NoClassDefFoundError with custom library and Google Play Service dependencies

I'm working on an App for Android which uses a custom library. This library needs the
implementation 'com.google.android.gms:play-services-ads:17.1.2'
I generate a plugin for unity with Android Studio and build the App. Everything works fine until I start using functions of the custom library. The app crashes with the following error message. What do I have to do to fix this NoClassDefFoundError for the Google Play Service stuff. I'm really stuck.
Process: com.example.app, PID: 10230
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient;
at com.customLib.lib.o.a(SourceFile:36)
at com.customLib.lib.i0.<init>(SourceFile:81)
at com.customLib.lib.e0.<init>(SourceFile:10)
at com.customLib.lib.u.a(SourceFile:17)
at com.customLib.lib.s$h.a(SourceFile:1)
at com.customLib.lib.p.run(SourceFile:1)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.identifier.AdvertisingIdClient" on path: DexPathList[[zip file "/data/app/com.example.app-DMDw0weJE1AN-hQFZpfcWA==/base.apk", zip file "/data/app/com.example.app-DMDw0weJE1AN-hQFZpfcWA==/split_config.arm64_v8a.apk"],nativeLibraryDirectories=[/data/app/com.example.app-DMDw0weJE1AN-hQFZpfcWA==/lib/arm64, /data/app/com.example.app-DMDw0weJE1AN-hQFZpfcWA==/base.apk!/lib/arm64-v8a, /data/app/com.example.app-DMDw0weJE1AN-hQFZpfcWA==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.customLib.lib.o.a(SourceFile:36)
at com.customLib.lib.i0.<init>(SourceFile:81)
at com.customLib.lib.e0.<init>(SourceFile:10)
at com.customLib.lib.u.a(SourceFile:17)
at com.customLib.lib.s$h.a(SourceFile:1)
at com.customLib.lib.p.run(SourceFile:1)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
Suppressed: java.io.IOException: No original dex files found for dex location (arm64) /data/app/com.example.app-DMDw0weJE1AN-hQFZpfcWA==/split_config.arm64_v8a.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:678)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:711)
at android.app.LoadedApk.getResources(LoadedApk.java:944)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2303)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5943)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
I'm working with Unity 2019.4
Thanks a lot for your help!
Cheers Stephan

How to solve a problem which causes app to crash when new dependency is added to gradle?

I am trying to integrate paynow api to my application, I have not done much, so far I have just added this dependance to gradle: implementation 'zw.co.paynow:java-sdk:1.1.1'
Supprisingly the app crashes, if I remove it the app does not crash, so adding it is crashing my app. So my question is, what could be missing that causes this crash?
logcat:
2021-06-11 19:32:31.825 25519-25519/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2021-06-11 19:32:31.829 25519-25519/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2021-06-11 19:32:32.655 25519-25519/com.coin.cryptobase E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.coin.cryptobase, PID: 25519
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.coin.cryptobase/com.coin.cryptobase.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.coin.cryptobase.MainActivity" on path: DexPathList[[zip file "/data/app/com.coin.cryptobase-faku93JC1CyPtG_PsAGmrA==/base.apk"],nativeLibraryDirectories=[/data/app/com.coin.cryptobase-faku93JC1CyPtG_PsAGmrA==/lib/arm, /system/lib, /system/vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2841)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6942)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.coin.cryptobase.MainActivity" on path: DexPathList[[zip file "/data/app/com.coin.cryptobase-faku93JC1CyPtG_PsAGmrA==/base.apk"],nativeLibraryDirectories=[/data/app/com.coin.cryptobase-faku93JC1CyPtG_PsAGmrA==/lib/arm, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1181)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6942) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 
Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.coin.cryptobase-faku93JC1CyPtG_PsAGmrA==/base.apk because: Failure to verify dex file '/data/app/com.coin.cryptobase-faku93JC1CyPtG_PsAGmrA==/base.apk': Bad method handle type 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:678)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:711)
at android.app.LoadedApk.getResources(LoadedApk.java:944)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2303)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5943)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
... 6 more
First clean the project, then invalidate android studio from File -> Invalidate Caches / Restart.. -> Invalidate and Restart.

RxJava 3.0.0 crashes a default Empty Activity project?

I create a new project in Android Studio 3.6 with default Empty Activity.
By just adding this to my gradle, sync and compile,
implementation "io.reactivex.rxjava3:rxjava:3.0.0"
The example app fail to even start, and crash as below
2020-03-09 21:47:15.448 12193-12193/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.elyeproj.myapplication, PID: 12193
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.elyeproj.myapplication/com.elyeproj.myapplication.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.elyeproj.myapplication.MainActivity" on path: DexPathList[[zip file "/data/app/com.elyeproj.myapplication-DiXzq-aNWvgVfrGsWCptJQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.elyeproj.myapplication-DiXzq-aNWvgVfrGsWCptJQ==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2718)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.elyeproj.myapplication.MainActivity" on path: DexPathList[[zip file "/data/app/com.elyeproj.myapplication-DiXzq-aNWvgVfrGsWCptJQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.elyeproj.myapplication-DiXzq-aNWvgVfrGsWCptJQ==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1173)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2708)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6541) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.elyeproj.myapplication-DiXzq-aNWvgVfrGsWCptJQ==/base.apk because: Failure to verify dex file '/data/app/com.elyeproj.myapplication-DiXzq-aNWvgVfrGsWCptJQ==/base.apk': Bad method handle type 8
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:676)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:709)
at android.app.LoadedApk.getResources(LoadedApk.java:936)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2242)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5672)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
... 6 more
Is this expected (i.e. I miss something), or is it a bug?
Note, adding implementation "io.reactivex.rxjava2:rxjava:2.2.18" compiles fine.
You need to use Android Studio 4.0 or newer (and more importantly, AGP 4.0 or newer) to use RxJava3 in Android projects, because that is what adds the new desugaring capabilities that RxJava3 relies on.

FATAL EXCEPTION: java.lang.ClassNotFoundException: Didn't find class "MainAcitivity" on path: DexPathList

I have searched extensively to find a solution for this issue and tried what I see has been suggested in the past.
Things I tried:
Deleted *.iml files locally
Deleted .idea files locally
Removed the project
Closed Android Studio and re-imported
Invalidated cached
Cleaned and re-builded.
I'm assuming what caused the problem is moving MainActivity to a newly created package. Any suggestions would be greatly appreciated.
2019-02-23 17:04:15.948 5842-5842/com.ssowens.android.myweatherapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ssowens.android.myweatherapp, PID: 5842
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ssowens.android.myweatherapp/com.ssowens.android.myweatherapp.ui.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.ssowens.android.myweatherapp.ui.MainActivity" on path: DexPathList[[zip file "/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/base.apk"],nativeLibraryDirectories=[/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2718)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ssowens.android.myweatherapp.ui.MainActivity" on path: DexPathList[[zip file "/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/base.apk"],nativeLibraryDirectories=[/data/app/com.ssowens.android.myweatherapp-UUO7m3VwjvpzPBPoUp-2AA==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1173)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2708)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6541) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

Categories

Resources