Android, how to export a jar of resources?

I am creating an Android project to create my custom widget, and I want to export it as a jar for another project to reuse them conveniently, but now the problem is that I cannot use the resources that are included in my jar widget settings, for example png -image, it gets zero from the resource identifier of class R! How can I process it?

Update question:
How can I parse LayerDrawable xml from a resource folder in code?

+4
source share
3 answers

You cannot currently export a standalone jar with an Android library, and advertised ones will be available in a future SDK release.
https://developer.android.com/guide/developing/projects/index.html#LibraryProjects

+5
source

You cannot export an Android project to Jar using resources. You can make the first project as a library, and then add it to another project.

See here. Documentation shows how to set up a project as a library and use in another project.

0
source

For the application to work with my exported .jar library file, I had to copy everything in the "res" resource directory from the library project to the application project. I also had to merge the string.xml file, as well as merge the ApplicationManfiest.xml files. To add a project as a library through eclipse is much simpler.

0
source

Source: https://habr.com/ru/post/1403414/


All Articles