JackHui
JackHui

Reputation: 11

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.

Upvotes: 1

Views: 1766

Answers (1)

Fahed Yasin
Fahed Yasin

Reputation: 410

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

Upvotes: 0

Related Questions