0

I created an android library that acts as a wrapper. I use some dependencies in the library notably Volley and Google Play Services. When I try to paste the .aar file in the project and compile it these libraries are not being imported and they throw an error. When I manually add these dependencies in the build.gradle of the new project then they work fine.

Is there way so that whenever my library is added it will auto import all the required dependencies?

Tyson
  • 747
  • 2
  • 6
  • 18

1 Answers1

1

just a friendly warning: including dependencies is considered a very bad practice at SHOULD BE AVOIDED.

However, if you do still want to do that, I suggest using the "download library from Maven" feature in Android Studio as described here.

This will make sure the library and all of its dependencies are downloaded.

Marcos Placona
  • 21,468
  • 11
  • 68
  • 93
  • Are you saying I should have dependencies in my libraries? I am writing a wrapper class for a Google Play Services API. Without the Play Services dependency my app won't even work. Is there any work around for this? – Tyson Jul 27 '17 at 10:32
  • If you really need that dependency in your library (I get it it's a wrapper), you should use `provided ` instead of `compile`. Have a look here (https://developer.android.com/studio/build/dependencies.html) under Library dependency configurations – Marcos Placona Jul 27 '17 at 10:39
  • I tried the `provided` keyword but I am getting the same error. It is not downloading the dependencies. – Tyson Jul 27 '17 at 11:11