》引用
1.将aar包放在libs目录下;
2.在app下的build.gradle文件中
repositories{
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile(name: 'baiduMapLib-release', ext: 'aar')
compile(name: 'toolKit-release', ext: 'aar')
}
》细节
1.只能在主程序app的build.gradle中引用,在library中则不会被发现。
2.用AS编译生成aar文件时,发现只有在libs下的jar能够被编译进aar包中,而通过compile"gradle路径"的方式引用的包则无法编译进aar包中。