361 lines
13 KiB
Groovy
361 lines
13 KiB
Groovy
apply plugin: 'com.android.application'
|
||
apply plugin: 'kotlin-android' // kotlin
|
||
apply plugin: 'kotlin-android-extensions'
|
||
apply plugin: 'kotlin-kapt'
|
||
|
||
// apkChannelPackage
|
||
apply plugin: 'channel'
|
||
|
||
apply from: 'tinker-support.gradle'
|
||
|
||
android {
|
||
|
||
androidExtensions {
|
||
experimental = true
|
||
}
|
||
|
||
dataBinding {
|
||
enabled = true
|
||
}
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_1_8
|
||
targetCompatibility JavaVersion.VERSION_1_8
|
||
}
|
||
|
||
dexOptions {
|
||
// jumboMode = true
|
||
javaMaxHeapSize "4g"
|
||
}
|
||
|
||
defaultConfig {
|
||
|
||
multiDexEnabled true
|
||
javaCompileOptions {
|
||
annotationProcessorOptions {
|
||
arguments = [eventBusIndex: 'com.gh.EventBusIndex']
|
||
}
|
||
}
|
||
|
||
ndk {
|
||
abiFilters "armeabi-v7a", "x86"
|
||
}
|
||
|
||
// 由于app只针对中文用户,所以仅保留zh资源,其他删掉
|
||
resConfigs "zh"
|
||
|
||
minSdkVersion rootProject.ext.minSdkVersion
|
||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||
versionCode rootProject.ext.versionCode
|
||
versionName rootProject.ext.versionName
|
||
applicationId rootProject.ext.applicationId
|
||
|
||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-fresco.txt'
|
||
|
||
/**
|
||
* All third-party appid/appkey
|
||
*/
|
||
buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
|
||
buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
|
||
buildConfigField "String", "TENCENT_APPID", "\"${TENCENT_APPID}\""
|
||
buildConfigField "String", "WEIBO_APPKEY", "\"${WEIBO_APPKEY}\""
|
||
buildConfigField "String", "MTA_APPKEY", "\"${MTA_APPKEY}\""
|
||
buildConfigField "String", "TD_APPID", "\"${TD_APPID}\""
|
||
|
||
/**
|
||
* Build Time 供区分 jenkins 打包时间用
|
||
*/
|
||
buildConfigField "long", "BUILD_TIME", "0"
|
||
|
||
}
|
||
|
||
// gradle 2.2以上默认同时启用v1和v2(优先用于Android N)
|
||
signingConfigs {
|
||
debug {
|
||
v1SigningEnabled true
|
||
v2SigningEnabled true
|
||
}
|
||
release {
|
||
v1SigningEnabled true
|
||
v2SigningEnabled true
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
debug {
|
||
debuggable true
|
||
minifyEnabled false
|
||
zipAlignEnabled false
|
||
signingConfig signingConfigs.debug
|
||
|
||
buildConfigField "String", "EXPOSURE_REPO", "\"test\""
|
||
buildConfigField "String", "EXPOSURE_VERSION", "\"E3\""
|
||
|
||
multiDexKeepProguard file("tinker_multidexkeep.pro")
|
||
}
|
||
release {
|
||
debuggable false
|
||
minifyEnabled true
|
||
zipAlignEnabled true
|
||
shrinkResources true
|
||
signingConfig signingConfigs.release
|
||
|
||
buildConfigField "String", "EXPOSURE_REPO", "\"exposure\""
|
||
buildConfigField "String", "EXPOSURE_VERSION", "\"E3\""
|
||
|
||
multiDexKeepProguard file("tinker_multidexkeep.pro")
|
||
}
|
||
}
|
||
|
||
flavorDimensions "nonsense"
|
||
|
||
/**
|
||
* 多渠道打包,渠道请参考"channel.txt"文件,所有渠道值均通过java code设置
|
||
*/
|
||
productFlavors {
|
||
// publish release host
|
||
publish {
|
||
dimension "nonsense"
|
||
buildConfigField "String", "API_HOST", "\"${API_HOST}\""
|
||
buildConfigField "String", "COMMENT_HOST", "\"${COMMENT_HOST}\""
|
||
buildConfigField "String", "DATA_HOST", "\"${DATA_HOST}\""
|
||
|
||
buildConfigField "String", "UMENG_APPKEY", "\"${UMENG_APPKEY}\""
|
||
buildConfigField "String", "UMENG_MESSAGE_SECRET", "\"${UMENG_MESSAGE_SECRET}\""
|
||
buildConfigField "String", "MIPUSH_APPID", "\"${MIPUSH_APPID}\""
|
||
buildConfigField "String", "MIPUSH_APPKEY", "\"${MIPUSH_APPKEY}\""
|
||
buildConfigField "String", "MEIZUPUSH_APPID", "\"${MEIZUPUSH_APPID}\""
|
||
buildConfigField "String", "MEIZUPUSH_APPKEY", "\"${MEIZUPUSH_APPKEY}\""
|
||
|
||
buildConfigField "String", "BUGLY_APPID", "\"${BUGLY_APPID}\""
|
||
}
|
||
// internal test dev host
|
||
internal {
|
||
dimension "nonsense"
|
||
versionNameSuffix "-debug"
|
||
|
||
buildConfigField "String", "API_HOST", "\"${DEV_API_HOST}\""
|
||
buildConfigField "String", "COMMENT_HOST", "\"${DEV_COMMENT_HOST}\""
|
||
buildConfigField "String", "DATA_HOST", "\"${DEV_DATA_HOST}\""
|
||
|
||
buildConfigField "String", "UMENG_APPKEY", "\"${DEBUG_UMENG_APPKEY}\""
|
||
buildConfigField "String", "UMENG_MESSAGE_SECRET", "\"${DEBUG_UMENG_MESSAGE_SECRET}\""
|
||
buildConfigField "String", "MIPUSH_APPID", "\"${DEBUG_MIPUSH_APPID}\""
|
||
buildConfigField "String", "MIPUSH_APPKEY", "\"${DEBUG_MIPUSH_APPKEY}\""
|
||
buildConfigField "String", "MEIZUPUSH_APPID", "\"${DEBUG_MEIZUPUSH_APPID}\""
|
||
buildConfigField "String", "MEIZUPUSH_APPKEY", "\"${DEBUG_MEIZUPUSH_APPKEY}\""
|
||
|
||
buildConfigField "String", "BUGLY_APPID", "\"${DEBUG_BUGLY_APPID}\""
|
||
}
|
||
}
|
||
}
|
||
|
||
// apkChannelPackage
|
||
channel {
|
||
//多渠道包的输出目录,默认为new File(project.buildDir,"channel")
|
||
baseOutputDir = new File(project.buildDir, "channel")
|
||
//多渠道包的命名规则,默认为:${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}
|
||
apkNameFormat = '${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}'
|
||
}
|
||
|
||
rebuildChannel {
|
||
// baseDebugApk = 已有Debug APK
|
||
// baseReleaseApk = 已有Release APK
|
||
// //默认为new File(project.buildDir, "rebuildChannel/debug")
|
||
// debugOutputDir = Debug渠道包输出目录
|
||
// //默认为new File(project.buildDir, "rebuildChannel/release")
|
||
// releaseOutputDir = Release渠道包输出目录
|
||
}
|
||
|
||
repositories {
|
||
flatDir {
|
||
dirs 'libs/aars'
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
|
||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||
|
||
testImplementation 'junit:junit:4.12'
|
||
|
||
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakcanary}"
|
||
debugImplementation "com.facebook.stetho:stetho:${stetho}"
|
||
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stetho}"
|
||
debugImplementation "com.squareup.okhttp3:logging-interceptor:${okHttp}"
|
||
|
||
implementation "androidx.core:core:${core}"
|
||
implementation "androidx.fragment:fragment:${fragment}"
|
||
implementation "androidx.multidex:multidex:${multiDex}"
|
||
implementation "androidx.appcompat:appcompat:${appCompat}"
|
||
implementation "androidx.cardview:cardview:${cardView}"
|
||
implementation "androidx.annotation:annotation:${annotation}"
|
||
implementation "androidx.constraintlayout:constraintlayout:${constraintLayout}"
|
||
implementation "androidx.recyclerview:recyclerview:${recyclerView}"
|
||
implementation "androidx.lifecycle:lifecycle-runtime:${lifeCycle}"
|
||
implementation "androidx.lifecycle:lifecycle-extensions:${lifeCycle}"
|
||
kapt "androidx.lifecycle:lifecycle-compiler:${lifeCycle}"
|
||
implementation "androidx.room:room-runtime:${room}"
|
||
implementation "androidx.room:room-rxjava2:${room}"
|
||
implementation "androidx.core:core-ktx:${ktx}"
|
||
kapt "androidx.room:room-compiler:${room}"
|
||
kapt "androidx.databinding:databinding-compiler:${databinding}"
|
||
|
||
implementation "com.google.android.material:material:${material}"
|
||
|
||
implementation "com.kyleduo.switchbutton:library:${switchButton}"
|
||
|
||
implementation "com.facebook.fresco:fresco:${fresco}"
|
||
implementation "com.facebook.fresco:animated-gif:${fresco}"
|
||
implementation "com.facebook.fresco:animated-drawable:${fresco}"
|
||
|
||
implementation "com.squareup.okhttp3:okhttp:${okHttp}"
|
||
|
||
implementation "com.leon.channel:helper:${apkChannelPackage}"
|
||
|
||
implementation "com.squareup.retrofit2:retrofit:${retrofit}"
|
||
implementation "com.squareup.retrofit2:converter-gson:${retrofit}" // include gson 2.7
|
||
implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit}"
|
||
|
||
implementation "com.j256.ormlite:ormlite-android:${ormlite}"
|
||
implementation "com.j256.ormlite:ormlite-core:${ormlite}"
|
||
|
||
implementation "com.jakewharton:butterknife:${butterKnife}"
|
||
kapt "com.jakewharton:butterknife-compiler:${butterKnife}"
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
|
||
|
||
implementation "org.greenrobot:eventbus:${eventbus}"
|
||
kapt "org.greenrobot:eventbus-annotation-processor:${eventbusApt}"
|
||
|
||
implementation "io.reactivex.rxjava2:rxjava:${rxJava2}"
|
||
implementation "io.reactivex.rxjava2:rxandroid:${rxAndroid2}"
|
||
implementation "com.jakewharton.rxbinding2:rxbinding:${rxBinding2}"
|
||
|
||
implementation "com.google.zxing:core:${zxing}"
|
||
implementation "com.google.zxing:android-core:${zxing}"
|
||
|
||
implementation "com.daimajia.swipelayout:library:${swipeLayout}"
|
||
|
||
implementation "com.sina.weibo.sdk:core:${weiboSDK}"
|
||
|
||
// bugly with tinker support
|
||
implementation "com.tencent.bugly:crashreport_upgrade:${buglyTinkerSupport}"
|
||
|
||
implementation 'com.google.android:flexbox:1.1.0'
|
||
|
||
implementation "pub.devrel:easypermissions:${easypermissions}"
|
||
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||
|
||
implementation 'com.contrarywind:Android-PickerView:4.1.3'
|
||
|
||
implementation "com.scwang.smartrefresh:SmartRefreshLayout:${smartRefreshLayout}"
|
||
implementation "net.cachapa.expandablelayout:expandablelayout:${expandableLayout}"
|
||
|
||
// 用于比较 versionName 是大于小于或等于
|
||
implementation "com.g00fy2:versioncompare:${versioncompare}"
|
||
|
||
implementation "top.zibin:Luban:${luban}"
|
||
|
||
implementation "com.squareup.picasso:picasso:${picasso}"
|
||
|
||
// for video streaming
|
||
implementation ("com.shuyu:gsyVideoPlayer-java:$gsyVideo",{
|
||
exclude module: "gsyvideoplayer-androidvideocache"
|
||
})
|
||
implementation "com.shuyu:GSYVideoPlayer-exo2:$gsyVideo"
|
||
implementation "com.shuyu:gsyVideoPlayer-armv7a:$gsyVideo"
|
||
implementation "com.shuyu:gsyVideoPlayer-x86:$gsyVideo"
|
||
|
||
implementation "com.github.wendux:DSBridge-Android:$dsBridge"
|
||
|
||
implementation "android.arch.work:work-runtime:${workManager}"
|
||
|
||
implementation "com.llew.huawei:verifier:1.0.6"
|
||
|
||
implementation "com.github.tbruyelle:rxpermissions:${rxPermissions}"
|
||
|
||
implementation 'com.ethanhua:skeleton:1.1.1'
|
||
implementation 'io.supercharge:shimmerlayout:2.1.0'
|
||
implementation "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1"
|
||
implementation 'com.walkud.rom.checker:RomChecker:1.0.0'
|
||
|
||
debugImplementation "com.github.nichbar.chucker:library:$chucker"
|
||
releaseImplementation "com.github.nichbar.chucker:library-no-op:$chucker"
|
||
implementation "com.bytedance.applog:RangersAppLog-Lite-cn:$bytedanceApplog"
|
||
|
||
implementation 'com.aliyun.dpa:oss-android-sdk:2.9.2'
|
||
|
||
implementation "com.airbnb.android:lottie:$lottie"
|
||
|
||
implementation("com.github.piasy:BigImageViewer:$bigImageViewer", {
|
||
exclude group: 'com.squareup.okhttp3'
|
||
})
|
||
|
||
implementation project(':libraries:LGLibrary')
|
||
implementation project(':libraries:MTA')
|
||
implementation project(':libraries:QQShare')
|
||
implementation project(':libraries:TalkingData')
|
||
implementation project(':libraries:UmengPush')
|
||
// implementation project(':libraries:WechatShare')
|
||
implementation project(':libraries:im')
|
||
implementation project(':libraries:Matisse')
|
||
implementation project(path: ':libraries:gsyVideoPlayer-proxy_cache')
|
||
}
|
||
File propFile = file('sign.properties')
|
||
if (propFile.exists()) {
|
||
Properties props = new Properties()
|
||
props.load(new FileInputStream(propFile))
|
||
|
||
if (props.containsKey('keyAlias') && props.containsKey('keyPassword') &&
|
||
props.containsKey('storeFile') && props.containsKey('storePassword')) {
|
||
android.signingConfigs {
|
||
// debug 不要使用正式签名,这样tinker才不会打补丁。
|
||
debug {
|
||
keyAlias props.get('keyAlias')
|
||
keyPassword props.get('keyPassword')
|
||
storeFile file(props.get('storeFile'))
|
||
storePassword props.get('storePassword')
|
||
}
|
||
release {
|
||
keyAlias props.get('keyAlias')
|
||
keyPassword props.get('keyPassword')
|
||
storeFile file(props.get('storeFile'))
|
||
storePassword props.get('storePassword')
|
||
}
|
||
}
|
||
} else {
|
||
android.buildTypes.release.signingConfig = null
|
||
}
|
||
} else {
|
||
android.buildTypes.release.signingConfig = null
|
||
}
|
||
|
||
// 用于测试读取 META-INF 里的 JSON 的代码
|
||
//task generateMetaJson {
|
||
// def resDir = new File(buildDir, 'generated/FILES_FOR_META_INF/')
|
||
// def destDir = new File(resDir, 'META-INF/')
|
||
// // Add resDir as a resource directory so that it is automatically included in the APK.
|
||
// android {
|
||
// sourceSets {
|
||
// main.resources {
|
||
// srcDir resDir
|
||
// }
|
||
// }
|
||
// }
|
||
//
|
||
// doLast {
|
||
// if (!destDir.exists()) destDir.mkdirs()
|
||
// copy {
|
||
// into destDir
|
||
// from new File('generated/FILES_FOR_META_INF/META-INF/halo_skip.json')
|
||
// }
|
||
// }
|
||
//}
|
||
//// Specify when put_files_in_META_INF should run
|
||
//project.afterEvaluate {
|
||
// tasks.findAll { task ->
|
||
// task.name.startsWith('merge') && task.name.endsWith('Resources')
|
||
// }.each { t -> t.dependsOn generateMetaJson }
|
||
//}
|