Include aar into aar

安稳与你 提交于 2021-01-27 10:46:31

问题


I have an android library distributed in aar format. It weight 300kb. I want to create another library and also in aar format, where first library in dependencies. But result library weight is 30kb, so obviously it does not not include first library.

I tried to add first library using flatDir:

repositories {
    flatDir {
        dirs 'libs'
    }
}
dependencies {
    compile(name:'mylib-1.0', ext:'aar')
}

And publish to mavenLocal using maven-publish:

repositories {
    mavenLocal()
}
dependencies {
    compile 'com.mylib:mylib:1.0.0@aar'
}

but still it does not include to result aar.

How to include my first aar to result aar?


回答1:


The best way to achieve it is to distribute the aar with a maven repo.

The aar file doesn't contain the transitive dependencies and doesn't have a pom file which describes the dependencies used by the library.
It means that, if you are importing a aar file using a flatDir repo you have to specify the dependencies also in your project.

Using a maven repository you will not have the same issue.
In this case, gradle downloads the dependencies using the pom file which will contains the dependencies list.



来源:https://stackoverflow.com/questions/37522112/include-aar-into-aar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!