Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin Android Bindings that uses Android.WorkManager

We are making an app that needs to use Android's WorkManager library. The dependency .AAR file is compiled and tested working. I was able to build a DLL by binding the dependency AAR file using Visual Studio's Java Bindings Project.

However, when the Xamarin Android project uses the dependency library that uses the Android WorkManager, it throws an exception:

            Java.Lang.NoClassDefFoundError: Failed resolution of: Landroidx/work/WorkManager; ---> 
            Java.Lang.ClassNotFoundException: Didn't find class "" on path: 
            DexPathList[[zip file "/data/app/"],nativeLibraryDirectories=[/data/app/, /data/app/!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]

I also tried downloading the Android WorkManager AAR file, created its own Bindings Library project, compiled that, and added it to the main Xamarin Forms project, along with the dependency AAR. But I get this error:

error: CommandsCompletedListener is not public in SystemAlarmDispatcher; cannot be accessed from outside package

Is there something I should include or modify in the dependency Bindings project?

I already tried adding the WorkManager AAR to the dependency Bindings project and using that, but I still get the ClassNotFoundException. Has anyone tried using a Java dependency that uses the WorkManager for Xamarin Android?


Sign In or Register to comment.