I have implemented a Library Project called "proximity" in Android Studio and generated an ".aar". This aar I've added to a new test project as an module, as stated here:https://stackoverflow.com/a/24894387/2791503 Furthermore I included the module as an dependency with the transitive flag, as it has been proposed here: https://stackoverflow.com/a/25730092/2791503 This is may gradle File for the new TestProject:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile(project(':proximity')) {
transitive=true
}
Still when I launch the App it tells me that it can not find a class of the Google Location API, which is a dependency of my library module.
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/GoogleApiClient$Builder;
How can I force gradle to include those transitive dependencies of my library module?
EDIT: Here is the gradle build file of the original library project:
dependencies {
//integration tests
androidTestCompile 'com.android.support.test:runner:0.4.1'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4.1'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator- v18:2.1.2'
androidTestCompile 'com.android.support:support-annotations:23.1.1'
//local unit testing
testCompile 'junit:junit:4.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
//estimote sdk
compile 'com.estimote:sdk:0.9.4@aar'
//google location api(GPS)
compile 'com.google.android.gms:play-services-location:8.4.0'
//Google Guave Java Util
compile 'com.google.guava:guava:18.0'
//custom BeSpoon library for android
compile project(':bespoonlibrary')
}
And this is how the gradle build file looks after importing the library as a module referencing the aar:
configurations.create("default")
artifacts.add("default", file('app-release.aar'))