Files
TTUtils/app/build.gradle
2022-11-16 16:18:03 +08:00

379 lines
14 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'
apply plugin: "com.tencent.android.tpns"
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"
//https://github.com/flutter/flutter/issues/58758
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 26
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 = [
XG_ACCESS_ID : "1500026407",
XG_ACCESS_KEY: "AQ6C6W1O19LT",
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"
buildConfigField "String", "ROOT_URL", '"https://193.112.158.183"'
}
beta {
flavorDimensions "default"
versionCode 100
versionName "1.0"
buildConfigField "String", "ROOT_URL", '"https://193.112.158.183"'
}
}
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 {
tuixin {
storeFile file("src/keystore/tuixin.jks")
storePassword "123456"
keyAlias "universal"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
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
}
own {
storeFile file("src/keystore/tt.jks")
storePassword "fht19961207"
keyAlias "key0"
keyPassword "981964879aa"
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
tuiXinDebug.initWith(debug)
tuiXinDebug {
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.tuixin
}
zhanRuiDebug.initWith(debug)
zhanRuiDebug {
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRui
}
zhanRuiRelease.initWith(release)
zhanRuiRelease {
buildConfigField "String", "platform", '"ZhanRui"'
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.xueshibao
//将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"])
compileOnly files('libs/framework.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.viewpager2:viewpager2: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'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
// implementation "androidx.datastore:datastore:1.0.0"
// // optional - RxJava2 support
//// implementation "androidx.datastore:datastore-rxjava2:1.0.0"
// // optional - RxJava3 support
// implementation "androidx.datastore:datastore-rxjava3:1.0.0"
// implementation "androidx.datastore:datastore-core:1.0.0"
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'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version)
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
//rxlifecycle
implementation 'com.trello.rxlifecycle4:rxlifecycle:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-android:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-components:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-components-preference:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'
//okhttp
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.moshi:moshi:1.9.3'
//4.9.3最后一个4.x版本
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
//磁盘缓存
implementation 'com.jakewharton:disklrucache:2.0.2'
//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.3'
// If you are using Kotlin, replace annotationProcessor with kapt.
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
//MMKV
implementation 'com.tencent:mmkv-static:1.2.13'
//腾讯移动推送 TPNS
implementation 'com.tencent.tpns:tpns:1.2.2.0-release'
//内存泄漏检测
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.8.0'
// 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'
}
preBuild {
doLast {
def imlFile = file(project.name + ".iml")
println 'Change ' + project.name + '.iml order'
try {
def parsedXml = (new XmlParser()).parse(imlFile)
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
parsedXml.component[1].remove(jdkNode)
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
println 'what' + sdkString
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
} catch (FileNotFoundException e) {
// nop, iml not found
println "no iml found"
}
}
//https://www.pianshen.com/article/93481144911/
//https://blog.csdn.net/dhl_1986/article/details/102856026
//使用系统编译后的framework.jar
}