Online Permissions .aar

My goal is to distribute an .aar file that can be used by other developers in their projects. The problem I find is when I try to integrate my .aar into another project, I need to list all the dependencies in the build.gradle file that I already included in my .aar build.gradle.

My question, if possible, only includes my library as a dependency, and somehow the libraries my library depends on will be included in another project.

For example, my library defines the following dependencies in the build.gradle file:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.altbeacon:android-beacon-library:2.3.5'
    compile 'commons-codec:commons-codec:1.10'
}

      

I wrote a test application that uses my library and adds the same module to Android Studio interface

dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile project(':myLibrary')
}

      

However, this doesn't work. I am getting java.lang.VerifyErrors at runtime. What ends up being include this in your app build.gradle file:

dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:7.5.0'


    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.altbeacon:android-beacon-library:2.3.5'
    compile 'commons-codec:commons-codec:1.10'


    compile project(':myLibrary')
}

      

Why do I need to include dependencies in both .aar and final application? What am I misunderstanding about how dependencies work? Why can't the final application grab .aar dependencies from maven or jCenter at build time?

+3


source to share





All Articles