In order to have multiple app sharing the same functionality I have moved all code to a separate library project but still have a doubt If I did everything correct and the issue with running app on devices which do not support multidex natively.
So basically my questions are:
[AndroidRuntime] Caused by: java.lang.ClassNotFoundException: Didn't find class "TestApp" on path: /data/app/com.test-1.apk [AndroidRuntime] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64) [AndroidRuntime] at java.lang.ClassLoader.loadClass(ClassLoader.java:501) [AndroidRuntime] at java.lang.ClassLoader.loadClass(ClassLoader.java:461) [AndroidRuntime] at android.app.Instrumentation.newApplication(Instrumentation.java:992) [AndroidRuntime] at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
and inspection of apk shows that MutiDexApplication is packaged to the second dex, when I assume it should present in the main dex as it is a base class for my application:
\smali\com.test\TestApp.smali \smali_classes2\android\support\multidex\MultiDexApplication.smali
So if this is the issue then how to make Xamarin / Android SDK to properly allocate classes?
Posts
For those who is interested there is a cross-tool issue on Windows. Build process generates an input which is not compatible with a script from android tools (which has its own issues on Windows) and as a result the list of classes selected to be moved to the first DEX stays empty.
Here are changes I've done to
\sdk\build-tools\23.0.x\mainDexClasses.bat
:Also I've raised a ticket for Xamarin to fix at least first part of the issue: https://bugzilla.xamarin.com/show_bug.cgi?id=38693
Hi MikhailMelnik,
Could you share a copy of your mainDexClasses.bat with the changes?
Thanks,
Brad
Sure, here it is.