繁体   English   中英

如果依赖项在aar库中声明,我是否需要在应用程序的build.gradle中对同一库进行delcare?

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

作为标题,我在模块的build.gradle中声明依赖项,然后将库导出到aar文件中。 但是,当我将aar集成到另一个android项目(比如项目B)时,我必须在项目B中再次声明样本依赖项。


我的问题是 “无论如何在aar文件中包含所有库,并且在项目B中,我只能在没有任何其他依赖项的情况下包含该aar库?”


这是我模块库的依赖

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'
}

但是在我的android项目B中,在包含aar之后,我仍然需要添加其他库。

这是我的Android项目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'
}

有人可以帮忙吗? 谢谢。

默认情况下,AAR不包含任何依赖项。 如果要包括它们,则必须通过手动执行将这些库从模块复制到软件包中,否则此任务可能会对您有所帮助: https : //stackoverflow.com/a/33539941/4310905

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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