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 "androidx.work.WorkManager" on path: 
            DexPathList[[zip file "/data/app/com.appname.app-vXQN7f21kz_QrhvSakWVRA==/base.apk"],nativeLibraryDirectories=[/data/app/com.appname.app-vXQN7f21kz_QrhvSakWVRA==/lib/arm64, /data/app/com.appname.app-vXQN7f21kz_QrhvSakWVRA==/base.apk!/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
    androidx.work.impl.background.systemalarm.SystemAlarmDispatcher.CommandsCompletedListener

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?

Answers

Sign In or Register to comment.