Multiple issues with library project and multidex

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:

  • What is the proper location and build action for AndroidManifest.xml in library?
  • Is it enough to reference required libraries (say, Play Services, Facebook etc) only in this library and leave application references clear? The thing is it kind of works either way but if I don't reference say Xamarin.GooglePlayServices.Ads in application it won't build because of missing resource references.
  • Somehow enabling ProGuard doesn't help much, it decreases number from 88k to 84k only. Is there any other step required?
  • On devices which do not support multidex I'm getting an error
[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

Sign In or Register to comment.