Can an Android library JAR depend on an Android library AAR?

By : Matthew
Source: Stackoverflow.com
Question!

I have an Android library project FooLib. FooLib references things like Android Contexts but doesn't require any resource files (things in res/) so I am currently packaging this as a JAR for my app to consume.

I now want to make FooLib depend on BarLib, but BarLib does use resources so I can't package BarLib as a JAR. Instead, it is packaged as an AAR. Is it possible for me to have FooLib depend on BarLib but continue to package FooLib as a JAR? Or, does having an AAR dependency in FooLib force me to make it an AAR also?

By : Matthew


Answers

Because AAR format does not contain classes directly as jar files do it is no use for a non Android project. Therefore it would be better to make FooLib an AAR.

Another solution would be to extract jar library from BarLib and depend on it.



This video can help you solving your question :)
By: admin