Files
TTUtils/app/build.gradle
2021-10-15 18:09:11 +08:00

311 lines
11 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def appName() {
return "TT"
}
def releaseTime() {
return new Date().format("yyyyMMdd", TimeZone.getDefault())
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.tt.ttutils"
minSdkVersion 24
targetSdkVersion 30
// versionCode 1
// versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
//添加
exclude 'META-INF/rxjava.properties'
}
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
// 还可以添加 'armeabi' , 'x86', 'x86_64', 'mips', 'mips64'
}
manifestPlaceholders = [
JPUSH_PKGNAME: applicationId,
JPUSH_APPKEY : "731637f412deca8540a1f873", //JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
]
}
externalNativeBuild {
cmake {
path 'CMakeLists.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
}
dexOptions {
jumboMode true
}
//多版本
productFlavors {
official {
flavorDimensions "default"
versionCode 1
versionName "1.0"
}
beta {
flavorDimensions "default"
versionCode 1
versionName "1.0"
buildConfigField "String", "test", '"测试文本"'
}
}
sourceSets {
beta.res.srcDirs = ['src/beta/res']
}
// externalNativeBuild {
// ndkBuild {
// path 'src/main/jni/Android.mk'
// }
// }
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDirs = ['src/main/jniLibs']
}
//签名
signingConfigs {
xueshibao {
storeFile file("src/keystore/xueshibaoos.jks")
storePassword "123456"
keyAlias "xueshibaoos"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
zhanRui {
storeFile file("src/keystore/zhanxun.keystore")
storePassword "123456"
keyAlias "zhanxun"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
zhanRuiUserdebug {
storeFile file("src/keystore/zhanxunUserdebug.keystore")
storePassword "123456"
keyAlias "zhanxunUserdebug"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
debug {
storeFile file("src/keystore/tt.jks")
storePassword "fht19961207"
keyAlias "key0"
keyPassword "981964879aa"
v1SigningEnabled true
v2SigningEnabled false
}
release {
storeFile file("src/keystore/tt.jks")
storePassword "fht19961207"
keyAlias "key0"
keyPassword "981964879aa"
v1SigningEnabled true
v2SigningEnabled false
}
}
buildTypes {
zhanRuiRelease.initWith(release)
zhanRuiRelease {
buildConfigField "String", "platform", '"ZhanRui"'
signingConfig signingConfigs.zhanRui
}
zhanRuiDebug.initWith(debug)
zhanRuiDebug {
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRui
}
//userdebug rom使用这个版本
zhanRuiUserdebug.initWith(zhanRuiDebug)
zhanRuiUserdebug {
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRuiUserdebug
}
debug {
buildConfigField "String", "platform", '"MTK"'
// 不显示Log
//buildConfigField "boolean", "LOG_DEBUG", "false"
//
versionNameSuffix "-debug"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
signingConfig signingConfigs.xueshibao
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null) {
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
output.outputFileName = fileName
}
}
}
}
release {
buildConfigField "String", "platform", '"MTK"'
//混淆
minifyEnabled false
//前一部分代表系统默认的android程序的混淆文件该文件已经包含了基本的混淆声明后一个文件是自己的定义混淆文件
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
//签名
signingConfig signingConfigs.release
//将release版本的包名重命名加上版本及日期
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = ""
if (outputFile != null) {
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${productFlavors[0].name}-${buildType.name}.apk"
output.outputFileName = fileName
}
}
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(':viewlibrary')
implementation project(path: ':niceimageview')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//constraintlayout:2.0.4以上在Android studio 3.6.2不能预览
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
// implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.security:security-crypto:1.1.0-alpha03"
implementation 'androidx.multidex:multidex:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
////三方
//极光推送
implementation 'cn.jiguang.sdk:jpush:3.8.6' // 此处以JPush 3.7.0 版本为例。
implementation 'cn.jiguang.sdk:jcore:2.6.0' // 此处以JCore 2.4.2 版本为例。
//RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.2.5'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
//okhttp
implementation 'com.squareup.okhttp3:okhttp:4.6.0'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
//Google
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.google.android.material:material:1.4.0'
//Jackson
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
//view绑定
implementation 'com.jakewharton:butterknife:10.2.1'
// If you are using Kotlin, replace annotationProcessor with kapt.
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
//MMKV
implementation 'com.tencent:mmkv-static:1.2.10'
//内存泄漏检测
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
////图片加载框架
//Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
//Fresco
implementation 'com.facebook.fresco:fresco:2.2.0'
//Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
//个人
//utilcode工具类
implementation 'com.blankj:utilcodex:1.30.6'
//更换字体框架
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
//屏幕适配方案
//https://github.com/JessYanCoding/AndroidAutoSize
implementation 'me.jessyan:autosize:1.2.1'
//滑动关闭当前 Activity
implementation 'com.r0adkll:slidableactivity:2.1.0'
//滑动返回
implementation 'com.github.bingoogolapple:BGASwipeBackLayout-Android:2.0.2'
//圆角
implementation 'de.hdodenhof:circleimageview:2.2.0'
//圆角ImageView
implementation 'com.github.zane618:NiceImageView:1.0.0'
// 权限请求框架https://github.com/getActivity/XXPermissions
implementation 'com.github.getActivity:XXPermissions:12.3'
//动态权限框架
implementation 'com.yanzhenjie:permission:2.0.3'
//沉浸状态栏
implementation 'com.gitee.zackratos:UltimateBarX:0.7.1'
// implementation 'com.gyf.barlibrary:barlibrary:2.2.8'
// 基础依赖包,必须要依赖
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
// fragment快速实现可选
implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0'
// kotlin扩展可选
implementation 'com.gyf.immersionbar:immersionbar-ktx:3.0.0'
//网络监听
implementation 'com.github.tianma8023:NetDetector:v0.2.0'
}