Dependency error when using aar library

I have a module with a .aar file in the libs folder. I used the solution posted here [1]: http://kevinpelgrims.com/blog/2014/05/18/reference-a-local-aar-in-your-android-project/ to add the .aar file as dependencies and was able to compile the module correctly.

Now I want to use this module as a dependency on the main module in my project and compilation. However, when I try to compile, I see an error saying that gradle could not find the specific .aar file . why my main module will not find the file that is in the libs folder of my add-on module. Interestingly, anyone ran into this problem.

my project structure is like this

--mainmodule --build.gradle (submodule as a dependency) --submodule --libs -- abc.aar 

Here is the gradle throws error: When unzipping library ':abc:, either group, name or version is empty

+6
source share
1 answer

If I understand your problem correctly, and you followed the steps described in the link that you shared by adding this to your mainmodule build.gradle , complete the following task:

 flatDir { dirs "../submodule/libs" } 

You basically have a problem that you fixed in your submodule , since mainmodule trying to resolve the transitive (abc.aar) submodule .

Recommended Method:

While the answer above should fix your problem, Android Studio supports the best way to do this. Import the local aar file using the File> New> New module> Import .JAR / .AAR Package option in Android Studio v1.3 +. Then you can depend on this aar-module submodule as follows:

 dependencies { compile project(':aar-module') } 
+7
source

All Articles