11

I'm using Android Studio 1.4

I have a module in my project that's having next dependencies in build.gradle:

dependencies {
    provided fileTree(dir: 'libs', include: ['*.jar'])
    provided 'junit:junit:4.12'
    apply plugin: 'com.google.gms.google-services'
    provided 'org.apache.directory.studio:org.apache.commons.io:2.4'
    provided 'com.google.android.gms:play-services:8.1.0'
    provided 'com.fasterxml.jackson.core:jackson-databind:2.2.0'
    provided 'com.fasterxml.jackson.core:jackson-core:2.2.0'
    provided 'com.fasterxml.jackson.core:jackson-annotations:2.2.0'
}

After building the projectn and syncing gradle, I getting lib-release.aar at my module/build/ouputs/aar folder. Than I trying to File>New Module>Import JAR\AAR it. Then, after adding

compile project(':mylib-release')

I'm getting only my package without stated dependencies at "External Libraries" tree. How to enable autoinstall of these packages via only compilling my library?

Vassily
  • 5,263
  • 4
  • 33
  • 63

2 Answers2

6

Use

compile fileTree(dir: 'libs', include: ['*.jar'])

instead of

provided fileTree(dir: 'libs', include: ['*.jar'])
ADattatrey
  • 252
  • 2
  • 10
2

provided means you will compile against the dependencies, but at runtime, the system will make those available via a class loader (they won't be bundled in your APK).

Normally you'd want to use compile, not provided. An example of a provided dependency is the Android SDK itself. If you are using gradle, the Android plugins handle making that available at compile time and you don't need to call it out explicitly however.

Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134