老婆保佑,代碼無BUG
apply plugin: 'com.android.application'//說明module的類型蚕冬,com.android.application為程序柱宦,com.android.library為庫
android {
compileSdkVersion 22//編譯的SDK版本
buildToolsVersion "22.0.1"http://編譯的Tools版本
defaultConfig {//默認(rèn)配置
applicationId "com.nd.famlink"http://應(yīng)用程序的包名
minSdkVersion 8//支持的最低版本
targetSdkVersion 19//支持的目標(biāo)版本
versionCode 52//版本號(hào)
versionName "3.0.1"http://版本名
manifestPlaceholders = [ UMENG_CHANNEL_VALUE:"hsq" ]//聲明友盟渠道名是可變的
}
sourceSets {//目錄指向配置
main {
manifest.srcFile 'AndroidManifest.xml'//指定AndroidManifest文件
java.srcDirs = ['src']//指定source目錄
resources.srcDirs = ['src']//指定source目錄
aidl.srcDirs = ['src']//指定source目錄
renderscript.srcDirs = ['src']//指定source目錄
res.srcDirs = ['res']//指定資源目錄
assets.srcDirs = ['assets']//指定assets目錄
jniLibs.srcDirs = ['libs']//指定lib庫目錄
}
debug.setRoot('build-types/debug')//指定debug模式的路徑
release.setRoot('build-types/release')//指定release模式的路徑
}
signingConfigs {//簽名配置
release {//發(fā)布版簽名配置
storeFile file("fk.keystore")//密鑰文件路徑
storePassword "123"http://密鑰文件密碼
keyAlias "fk"http://key別名
keyPassword "123"http://key密碼
}
debug {//debug版簽名配置
storeFile file("fk.keystore")
storePassword "123"
keyAlias "fk"
keyPassword "123"
}
}
buildTypes {//build類型
release {//發(fā)布
minifyEnabled true//混淆開啟
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'//指定混淆規(guī)則文件
signingConfig signingConfigs.release//設(shè)置簽名信息
}
debug {//調(diào)試
signingConfig signingConfigs.release
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/MANIFEST.MF'
}
lintOptions {
abortOnError false//lint時(shí)候終止錯(cuò)誤上報(bào),防止編譯的時(shí)候莫名的失敗
}
//打包-渠道
productFlavors {
hsq{}
hsq_dx{}
hsq_wx{}
baidu{}
yingyongbao{}
ppzhushou{}
anzhi{}
zhushou360{}
huawei{}
lenovomm{}
wandoujia{}
mumayi{}
meizu{}
youyi{}
sougou{}
}
//打包-防渠道代碼重復(fù)處理
productFlavors.all { flavor ->
flavor.manifestPlaceholders = [ UMENG_CHANNEL_VALUE:name ]
}
}
dependencies {//依賴
compile fileTree(dir: 'libs', exclude: ['android-support*.jar'], include: ['*.jar']) //編譯lib目錄下的.jar文件
compile project(':Easylink')//編譯附加的項(xiàng)目
compile project(':ImageLibrary')
compile project(':ImageResLibrary')
compile project(':Ofdmtransport')
compile project(':PullToRefreshLibrary')
compile project(':RecorderLibrary')
compile project(':WebSocket')
compile project(':WidgetLibrary')
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'//編譯來自Jcenter的第三方開源庫
}
參考