3

First of all I know this error has been asked already but my case is a little different:

I'm distributing SDK (Android library project). My SDK needs among others things (play services, support v4, gson jars etc.) Picasso so I have in my gradle.build:

compile 'com.squareup.picasso:picasso:2.5.2'

Now when I test importing the resulted aar file from this library project to my sample app - all works fine.

The problem is that my customer when importing the aar file into his app project, trying to launch inside his app the Activity related with my SDK functionality getting the above error:

Failed resolution of: Lcom/squareup/picasso/Picasso:
java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.Picasso" on path: DexPathList[[zip file "/data/app/com.package.name-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

Note: I do need inside this Activity Picasso. We both use Android studio.

My question is where is the problem? Inside my library? In the way the customer integrates the aar?

  • The customers needs to modify his build.gradle with all my SDK's dependencies because I'm not distributing via maven
  • and also include my Activities inside his manifest.xml
  • Maybe the multidex has something to do here?
  • Maybe version of play services?
  • Maybe version of support lib V4 VS. appcompat V7?
  • Collusion in dependencies versions between what the customer compiled and what I compiled?
  • Order of dependencies in the gradle.build?
Community
  • 1
  • 1
michael
  • 3,835
  • 14
  • 53
  • 90
  • 1
    AAR files are only JARs with some Android stuff added, like resources and an `AndroidManifest.xml`. They *do not*, however know anything about their dependencies in general or about Gradle in particular. So, I guess the best way would be to distribute your library via a Maven repository (which includes the pom.xml that contains the information about the dependencies). – david.mihola Nov 20 '15 at 19:17
  • @david.mihola Thanks, This is known and I mentioned specifically that because I don't distribute it via `maven` the user of the SDK adds manually the dependencies. The question is what is the root cause for this bug? More specifically I need to know if the problem is inside my SDK or the problem is in the way the user integrate the SDK - So I will know to tell him: "look, you are doing something wrong in the integration process". Thanks, – michael Nov 20 '15 at 20:21
  • Yes, sorry, reading my comment again it sounds a bit weird - I really only wanted to confirm that distributing the AAR alone will not work and that Maven would be preferable. It's a bit convoluted, but have you considered (1) distributing to your local Maven repo and (2) zipping the directory in your repo that contains your library and (3) having your customer unzip that to their local repo and (4) including the library via Gradle and `mavenLocal` in their `build.gradle`? That way you could update them with newer version of your library, etc. – david.mihola Nov 20 '15 at 20:26
  • @david.mihola Thanks, We are well aware that's `maven` is the best choice, but because of business constrains with the customer - we can't do it. So basically right now we need to evaluate 1 of 2 options: 1. We have bug in our SDK 2. The user performs mistake during the integration process (which is complex, requires to modify manifst & build etc.). The only input we have is the log trace mentioned in the question. Thanks, – michael Nov 20 '15 at 20:30

1 Answers1

4

You have to disable "Instant Run"

Sergio Martin
  • 992
  • 8
  • 5