I'm trying to convert Android app to lib module, without copying source. I did it (modified build.gradle file), and it syncs and builds, but when I add dependency to resulting AAR file into another project (where I want to use this lib) build fails and resource linking fails.
I can't understand why:
original app builds and runs
lib module (converted from app) builds
project that uses AAR from that lib does not builds, and finds error in this AAR.
For example, one of the possible errors is:
Android resource linking failed
error: resource style/TextAppearance.Design.Tab (aka bv.dev.aarlibtester:style/TextAppearance.Design.Tab) not found.
error: failed linking references.
So it says that resources not found, and point to dependencies that I used in that lib (in this example it's design
)
I created test project to demonstrate this on simple example.
aar-res-app
is simple app project that usesdesign
dependencyaar-res-lib
is library created from this project (converted)aar-res-lib-tester
is simple app project that uses that lib.
Currently I renamed library package to do not match with application package, and using jar
instead of aar
.
I create it using Gradle -> root -> Tasks -> Other -> createFullJarRelease
.
Result is in Build > Intermediates > Full_jar > Release > CreateFullJarRelease > full.jar