1

My AAR includes a picasso library, but in my java code can't find picasso.

Here is my build.gradle: enter image description here

enter image description here

and here is my multi-image-selector AAR gradle: enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Cong Chen
  • 49
  • 8

4 Answers4

0

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'
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

Why you not using only

compile 'com.squareup.picasso:picasso:2.5.2'
Tran Vinh Quang
  • 585
  • 2
  • 9
  • 30
0

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:

Community
  • 1
  • 1
Stan Kurdziel
  • 5,476
  • 1
  • 43
  • 42
0

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

oiyio
  • 5,219
  • 4
  • 42
  • 54