默认大家用的 android studio
使用场景,明文了解场景
--- 这段时间,公司的项目正好遇到了这种情况,简单介绍下,这个项目本身是一个整体,领导希望我们将它拆成三部分
,主框架+A部分+B部分,A和B分别交给两拨人马去维护,这样A和B可以单独修改代码,而不会影响彼此,
好了,情况就是这个情况,我们决定使用AAR的方式去实现它
// 尝试使用 AAR 文件, 这里使用的是 aar 文件封装的 lib
// (比如封装个相机,录像机,二维码扫描,什么功能模块等,这样可以实现协同开发,同时可以让主程序保持整洁)
aar 打包方法 : https://blog.csdn.net/nicolelili1/article/details/53169470
aar 使用方法 : app 的 build.gradle 中 android 节点下 添加 标红的部分
//----------------------------------------------- build.gradle start -------------------------------------------------
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "包名"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'libs' // aar目录
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:27.1.1'
//这里是将生成的 aar 文件 , 放入 lib 后 , 引用的方法 ,例如: 我生成的 aar 文件名为: library_smart_tablayout.aar
compile(name: 'library_smart_tablayout',ext:'aar')
}
//----------------------------------------------- build.gradle end -------------------------------------------------