I have received an existing Xamarin project that I need to work on before we can release it.
I have tried installing it on 2 different devices:
- Nexus 5, running Android 6.0 (API 23)
- Emulator Android 4.4 (API 19) - Emulated through Visual Studio Emulator for Android
However, every time I do, it crashes on launch with a java.lang.classNotFoundException: Didn't find class "md515fc9a7f42ec11c09d24b1c1a9770737.ConnectScreen"
(full stacktrace below)
(ConnectScreen is my MainLauncher)
Things I've tried:
- Deleting bin/obj folder and rebuilding
- Clean Project and rebuild
- Killing MSBuild process, clean and rebuild
After doing some research, I have found Classy-Shark, which allows me to discover the DEX list in a .apk
file.
From this, it looks like the ConnectScreen is not compiled in the package md515fc9a7f42ec11c09d24b1c1a9770737
(that the app is looking for) but md5bc065f6c935f653292ddf7352d29f8ad
. This doesn't seem right to me?
(Those 2 package change every time I build the project)
I have tried to build a new project (Cross-Platform App, Native, Master Details, .NET Standard) and this project worked fine on my Nexus 5, so I don't think it's because of my phone or Visual Studio version?
I have tried changing the MultiDex settings, as well as the TargetFramework, but I still get the same issue.
Here's the full stacktrace:
Unhandled Exception:
Java.Lang.RuntimeException: Unable to instantiate activity ComponentInfo{MyApp.MyApp/md515fc9a7f42ec11c09d24b1c1a9770737.ConnectScreen}: java.lang.ClassNotFoundException: Didn't find class "md515fc9a7f42ec11c09d24b1c1a9770737.ConnectScreen" on path: DexPathList[[zip file "/data/app/MyApp.MyApp-1.apk"],nativeLibraryDirectories=[/data/app-lib/MyApp.MyApp-1, /system/lib]]
12-22 10:39:51.537 E/AndroidRuntime( 1255): FATAL EXCEPTION: main
12-22 10:39:51.537 E/AndroidRuntime( 1255): Process: MyApp.MyApp, PID: 1255
12-22 10:39:51.537 E/AndroidRuntime( 1255): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{MyApp.MyApp/md515fc9a7f42ec11c09d24b1c1a9770737.ConnectScreen}: java.lang.ClassNotFoundException: Didn't find class "md515fc9a7f42ec11c09d24b1c1a9770737.ConnectScreen" on path: DexPathList[[zip file "/data/app/MyApp.MyApp-1.apk"],nativeLibraryDirectories=[/data/app-lib/MyApp.MyApp-1, /system/lib]]
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.os.Handler.dispatchMessage(Handler.java:102)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.os.Looper.loop(Looper.java:136)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.app.ActivityThread.main(ActivityThread.java:5001)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at java.lang.reflect.Method.invoke(Method.java:515)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at dalvik.system.NativeStart.main(Native Method)
12-22 10:39:51.537 E/AndroidRuntime( 1255): Caused by: java.lang.ClassNotFoundException: Didn't find class "md515fc9a7f42ec11c09d24b1c1a9770737.ConnectScreen" on path: DexPathList[[zip file "/data/app/MyApp.MyApp-1.apk"],nativeLibraryDirectories=[/data/app-lib/MyApp.MyApp-1, /system/lib]]
12-22 10:39:51.537 E/AndroidRuntime( 1255): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
12-22 10:39:51.537 E/AndroidRuntime( 1255): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
12-22 10:39:51.537 E/AndroidRuntime( 1255): ... 11 more
12-22 10:39:53.137 I/Process ( 1255): Sending signal. PID: 1255 SIG: 9