有时需要使用第三方的aar库,或是工程源代码越来越大,项目内分工需要或出于模块化考虑,需要引用aar文件。
arr就像C/C++中的静态库。
如何建一个aar,网上的文章很多,这里不再重述。
通过gradle最普遍的方法是把aar上传到mavenCentral或者jcenter。如何引用一个本地aar,要在工程的module配置文件build.gradle中加入:
[plain] view plain copy
repositories {
flatDir {
dirs 'libs' //this way we can find the .aar file in libs folder
}