简体   繁体   中英

Android Build: Classes of a JAR file inside a AAR package are not recognized

I have a library project that I want to share as AAR file.

This library project contains several JAR files, some of them are classes I made and are used in the library project. For example I have a class in the lib project that inherits from a class inside the JAR file.

I was able to create the AAR file, and now I'm testing the AAR file in a sample app made in Android Studio.

I added the AAR file modifying the build.gradle file of the app module like this:

repositories {
    flatDir {
        dirs 'libs'
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile(name: 'mightylibrary', ext:'aar')
    compile 'com.android.support:appcompat-v7:20.+'
}

Then when I try to use methods from the parent class I'm not able to see them, only the methods implemented in the child class.

Is there any known limitation of accessing classes inside JARs packaged within a AAR file?

Any solution?

Thanks

So it seems I missed to add this

repositories {
    jcenter()
    mavenLocal() // Missed this
}

In the project (not the module) build.gradle file so it searchees in the local cache repo. What seems funny is then why it detected the classes within "classes.jar" but not in the other jars within "libs" folder of my AAR file. Interesting...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM