Android Binding Library Failed Resolution: L ...... / R $ layout

I'm trying to build Xamarin support for my Android SDK (so potential customers can implement it as a Xamarin Android app.

I was trying to avoid using AAR because I wanted the resources to be available to the client so the client can customize the layout. In an android library this is usually very easy because it is possible to create a JAR file from only the java classes and leave the res folder as well as all the resources available for editing. I tried to do the same with xamarin studio: I found the jar under the jars and also added .so files under lib / jni. Then I copied the contents of the res folder to Resources. The result was: In a Xamarin app (using the dll from the binding project) I could see Resources. But! When I run the java classes (I am using these resources in the SDK code), I get an error: java.lang.NoClassDefFoundError: permission failed: L ...... / R $ layout. I haven't found any documentation on using resources outside of the jar ...

Is there another option, perhaps with Android resources that are defined inside AAR, to override them outside of AAR.

Thanks in advance for any answer / link

+3


source to share


1 answer


The only major difference between JAR and AAR is that AAR can include resources. If a client needs to customize resources, you have several options.

  • A Xamarin.Android class library that can be modified, recompiled, and added to the project.
  • An Android class library that can be customized, then packaged in AAR to bind to the binding project.


Finally, you can always just instruct your clients to intentionally override the library resources, since the application resource will be preempted and not the library.

https://developer.android.com/studio/write/add-resources.html#resource_merging

+2


source







All Articles