Files
TTUtils/app/build.gradle
2021-04-08 11:22:29 +08:00

190 lines
6.3 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 16
targetSdkVersion 30
// versionCode 1
// versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a','x86'
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
}
manifestPlaceholders = [
JPUSH_PKGNAME: applicationId,
JPUSH_APPKEY : "731637f412deca8540a1f873", //JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
]
}
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'
}
lintOptions {
checkReleaseBuilds false
}
dexOptions {
jumboMode true
}
//多版本
productFlavors {
official {
flavorDimensions "default"
versionCode 1
versionName "1.0"
signingConfig signingConfigs.debug
}
beta {
flavorDimensions "default"
versionCode 1
versionName "1.0"
signingConfig signingConfigs.debug
buildConfigField "String", "test", '"测试文本"'
}
}
sourceSets {
beta.res.srcDirs = ['src/beta/res']
}
//签名
signingConfigs {
debug {
storeFile file("src/jks/tt.jks")
storePassword "fht19961207"
keyAlias "key0"
keyPassword "981964879aa"
v1SigningEnabled true
v2SigningEnabled false
}
release {
storeFile file("src/jks/tt.jks")
storePassword "fht19961207"
keyAlias "key0"
keyPassword "981964879aa"
v1SigningEnabled true
v2SigningEnabled false
}
}
buildTypes {
debug {
// 显示Log
buildConfigField "boolean", "LOG_DEBUG", "true"
versionNameSuffix "-debug"
minifyEnabled false
//Zipalign优化
zipAlignEnabled true
signingConfig signingConfigs.debug
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 {
// 不显示Log
buildConfigField "boolean", "LOG_DEBUG", "false"
//混淆
minifyEnabled false
//Zipalign优化
zipAlignEnabled true
//前一部分代表系统默认的android程序的混淆文件该文件已经包含了基本的混淆声明后一个文件是自己的定义混淆文件
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//签名
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 = new File(outputFile, fileName)
}
}
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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.7.0' // 此处以JPush 3.7.0 版本为例。
implementation 'cn.jiguang.sdk:jcore:2.4.2' // 此处以JCore 2.4.2 版本为例。
//okhttp
implementation 'com.squareup.okhttp3:okhttp:4.6.0'
//RxJava和Retrofit
implementation 'io.reactivex.rxjava2:rxjava:2.2.5'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
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'
////json解析
//Gson
implementation 'com.google.code.gson:gson:2.8.6'
//Jackson
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
//二维码
implementation 'com.google.zxing:core:3.3.0'
//个人
//更换字体框架
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
////图片加载框架
//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'
//屏幕适配方案
//https://github.com/JessYanCoding/AndroidAutoSize
implementation 'me.jessyan:autosize:1.2.1'
}