mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

Android: Crash when using AndroidX library #709

Open Zomb opened 6 years ago

Zomb commented 6 years ago

Steps to Reproduce

  1. Create a project using the support library
  2. Add in an e4k bound library which uses a LocalBroadcastManager
  3. Upgrade the project to AndroidX
  4. Run the project again

Expected Behavior

The project works the same way that it does in step 2.

Actual Behavior

The project crashes with the following exception:

E/mono-rt: [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.ClassNotFoundException: android.support.v4.content.LocalBroadcastManager ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v4.content.LocalBroadcastManager" on path: DexPathList[[zip file "/data/app/com.test.debug-fiT0voeEgy9Iuw7YkDwh2g==/base.apk", zip file "/data/app/com.test.debug-fiT0voeEgy9Iuw7YkDwh2g==/split_lib_resources_apk.apk", zip file "/data/app/com.test.debug-fiT0voeEgy9Iuw7YkDwh2g==/split_lib_slice_0_apk.apk"],nativeLibraryDirectories=[/data/app/com.test.debug-fiT0voeEgy9Iuw7YkDwh2g==/lib/arm64, /data/app/com.test.debug-fiT0voeEgy9Iuw7YkDwh2g==/base.apk!/lib/arm64-v8a, /data/app/com.test.debug-fiT0voeEgy9Iuw7YkDwh2g==/split_lib_resources_apk.apk!/lib/arm64-v8a, /data/app/com.test.debug-fiT0voeEgy9Iuw7YkDwh2g==/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /system/lib64]]

I assume this is because the project being bound is using the regular support libraries, while the native app is using the new AndroidX libraries. I could not find any bound Xamarin libraries on Nuget that map to the AndroidX ones, so I could not change that dependency. I did try to add the support libraries into the build.gradle as a dependency, but that did not seem to work either. Any suggestions are appreciated!

starkeyvsk commented 5 years ago

Is AndroidX support planned anytime soon? This is going to become problematic really soon with Android 10 coming out soon.