简体   繁体   中英

How to effectively add dependency .aar file in Xamarin project?

I am trying to create a Xamarin project using PayTM android library. Since PayTM doesn't have a direct Xamarin binding I have added the appinvokesdk-1.2.aar in the Xamarin Android Biding library project. The build action for appinvoke is "LibraryProjectZip". Now the appinvoke library also have a runtime dependency on easypay-8.7.3-appinvoke.aar (I found this after checking the pom file for appinvoke.aar file). I have set the build action for the easypay aar file as "EmbdedJar". I have also tried setting it to "LibraryProjectZip","ReferenceJar" and "EmbeddedReferenceJar". During runtime I am getting the error as

Java.Lang.ClassNotFoundException: Didn't find class "easypay.listeners.WebClientListener" on path: DexPathList[[zip file "/data/app/com.edmatix.poc.paytmdemo1-WQf3uMctjbNHoAG_ZfsH3A==/base.apk"],nativeLibraryDirectories=[/data/app/com.edmatix.poc.paytmdemo1-WQ…}

Here is my environment details

  • Visual Studio for Mac 8.5.4 (Build 12)
  • AndroidX assemblies
  • Xamarin.Form 4.6.0.726
  • Android Minimum API version 22
  • Android Target API 28 (Android 9)

the class easypay.listeners.WebClientListener is only required during run time and not during compile time.

Can you please help about how to properly embed the dependency library?

Thanks

so this is what I did to solve the issue of missing.aar file during runtime. I added the second.aar file (easypay-8.7.3-appinvoke.aar) into another Xamarin binding project (as shown in here ) and set the compile type as LibraryProjectZip. And that solved my issue with not finding the class in runtime.

Thanks

Please try to install Xamarin.Kotlin.StdLib in your Xamarin Android project. Installing the Kotlin package worked for me because I was using the .aar file which contains Kotlin code.

Install-Package Xamarin.Kotlin.StdLib -Version 1.3.50.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM