简体   繁体   中英

if the dependencies were declared in the aar library, do I need to delcare the same library in the build.gradle of the application?

as title, I declare the dependencies in the build.gradle of my module, and export the library into an aar file. however, when I integrate the aar into another android project(let's say project B), I have to declare the sample dependencies again in project B.


my question is "is there anyway to include all the libraries in the aar file, and in the project B, I can only include that aar library without any other dependencies?"


here is the dependency of my module library

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.android.gms:play-services-vision:11.6.2'
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.rmtheis:tess-two:9.0.0'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
}

but in my android project B, after the aar is included, I still need to add the other libraries.

here is the dependency of my android project B

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.my.library:com.my.library@aar'
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
    implementation 'com.google.android.gms:play-services-vision:11.6.2'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation 'com.rmtheis:tess-two:9.0.0'
}

Can anyone help? thanks.

By default AARs do not include any dependencies. If you want to include them you have to copy these libs from module into your package, either by doing it manually or this task might help you: https://stackoverflow.com/a/33539941/4310905

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