There are a few posts scattered about this, but my question is:
Has anyone managed to successfully create an application with MultiDex support that uses its own application class that will run on devices prior to Lollipop?
For people who want to know more about this, read on.
The problem is that when creating a MultiDex application using its own application class (I would suggest that the vast majority of applications within the 65k limit will be in this category), this class does not fall into the first dex file, which leads to device failure without built-in MultiDex support with an error
[AndroidRuntime] java.lang.RuntimeException: could not create application instance md5a3fc106bb082f0a6c07b5025b0a464e3.MyApplication: java.lang.ClassNotFoundException: could not find class "md5a3fc106bb082f0a6c07b25b3.b
I tried all the solutions listed, including from Xamarin support, to get to this.
There are many articles about this:
https://bugzilla.xamarin.com/show_bug.cgi?id=35491 https://forums.xamarin.com/discussion/57485/multiple-issues-with-library-project-and-multidex
What I've done:
I created my own MultiDexMainDexList file using a modified version of mainDexClasses.bat (according to the articles).
Then I changed the command that Xamarin throws at it to use the full path names, since Xamarin is just trying to use "obj \ Debug"
mainDexClasses_fixed.bat --output C: \ Users \ bradl_000 \ Documents \ blocke79 \ App \ App \ obj \ Debug \ multidex.keep "'C: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework \ MonoAndroid \ v6. 0 \ mono.android.jar '' C: \ androidsdk \ Extras \ Android \ support \ multidex \ library \ LIES \ Android support-multidex.jar '' C: \ Users \ bradl_000 \ Documents \ blocke79 \ App \ App \ obj \ Debug__library_projects __ \ Aniways.AndroidBinding \ library_project_imports \ aniways-V2.3.08.jar '"(trimmed this massive read list)
This creates a MultiDexMainDexList file with all the classes of my project. which I then add to my project with a new build action "MultiDexMainDexList" (only available in v6 alpha channel).
This eliminates the error regarding the application class, but instead creates a new error regarding the inability to find the PackageManager class.
java.lang.NoClassDefFoundError% 3A + mono.MonoPackageManager_Resources
Then I began to think that I should trim the entire list of classes in the MultiDexMainDexList file and save only those that I think should be loaded into the user class of the application. No matter what I did with this list, I still get the PackageManager error message. The package manager class is included, and I tried to play with the order of the classes in case that mattered.
mono / MonoPackageManager.class
Has anyone traveled the same path with more success than me? Is it possible?