My AAR includes a picasso library, but in my java code can't find picasso.
-
[This](http://stackoverflow.com/questions/24506648/adding-local-aar-files-to-gradle-build-using-flatdirs-is-not-working) may help you – webo80 Dec 15 '15 at 08:43
-
Thanks, but I'm not the same issue – Cong Chen Dec 15 '15 at 09:11
4 Answers
The aar file doesn't contain the nested dependencies and doesn't have a pom file which describes the dependencies used by the library.
It means that, if you are importing a aar file using a flatDir
repo you have to specify the dependencies also in your project.
In your case you have to add in your app (not the library):
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'

- 320,139
- 94
- 887
- 841
-
Sorry, I don't really understand what you say.Can I understand the library on aar file can't be used by other moudle – Cong Chen Dec 15 '15 at 08:55
-
I am saying that the aar file doesn't contain the picasso library and all other libraries used. – Gabriele Mariotti Dec 15 '15 at 09:26
Why you not using only
compile 'com.squareup.picasso:picasso:2.5.2'

- 585
- 2
- 9
- 30
-
-
If your aar file has zip picasso library, you can use this file. But in this case, your file is cannot. – Tran Vinh Quang Dec 15 '15 at 09:42
If you use the gradle maven plugin to deploy the aar to a local repo, then you can get transitive dependencies to work. Here's how to do that:

- 1
- 1

- 5,476
- 1
- 43
- 42
Assume that you have one app and one library module. In your library module you use Picasso as dependency.
Let me explain step by step, with possible scenarios.
1- If you add your library module to your app module as the following : implementation(project(":myLibrary")) Your library works correctly.
2- If you add your library module to your app module as the following : implementation files('../libs/mainLibrary-debug.aar') You may get a crash if you don't put Picasso dependency to your app module. You have two options to get rid of this crash.
2.a.First option is to add Picasso library to your app module.
2.b.The second option is to compile you aar using any fat aar plugin. If you use a fat aar plugin, when you generate aar, it automatically downloads Picasso library and put it in aar. In this way, you don't need to add Picasso dependency into your app module. There are several fat aar plugins available, here is one of them : https://github.com/kezong/fat-aar-android

- 5,219
- 4
- 42
- 54