plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' // id 'kotlin-kapt' id 'com.tencent.android.tpns' } def appName() { return "TTSTDUtils" } def releaseTime() { return new Date().format("yyyyMMdd", TimeZone.getDefault()) } android { namespace "com.ttstd.ttutils" compileSdkVersion 36 buildToolsVersion "36.0.0" defaultConfig { applicationId "com.ttstd.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 36 // versionCode 1 // versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true 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', 'x86_64' // 还可以添加 'armeabi' , 'x86', 'x86_64', 'mips', 'mips64' } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors are found: abortOnError false } manifestPlaceholders = [ XG_ACCESS_ID : "1500026407", XG_ACCESS_KEY: "AQ6C6W1O19LT", ] } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } // 添加 Kotlin 编译选项 kotlinOptions { jvmTarget = '1.8' } buildFeatures { dataBinding true buildConfig true aidl true } externalNativeBuild { cmake { path 'CMakeLists.txt' } } //多版本 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("keystore/tuixin.jks") storePassword "123456" keyAlias "universal" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } xueshibao { storeFile file("keystore/xueshibaoos.jks") storePassword "123456" keyAlias "xueshibaoos" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } teclastMTK { storeFile file("keystore/TeclastMTK.jks") storePassword "123456" keyAlias "TeclastMTK" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } teclastUnisoc { storeFile file("keystore/TeclastUnisoc.keystore") storePassword "123456" keyAlias "teclast" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } zhanRui { storeFile file("keystore/zhanxun.keystore") storePassword "123456" keyAlias "zhanxun" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } zhanRuiUserdebug { storeFile file("keystore/zhanxunUserdebug.keystore") storePassword "123456" keyAlias "zhanxunUserdebug" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } zhanruiG10Z { storeFile file("keystore/zhanruiG10Z.keystore") storePassword "123456" keyAlias "zhanruiG10Z" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } zhanRui12 { storeFile file("keystore/zhanrui12.jks") storePassword "123456" keyAlias "zhanrui12" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } own { storeFile file("keystore/tt.jks") storePassword "fht19961207" keyAlias "key0" keyPassword "981964879aa" v1SigningEnabled true v2SigningEnabled true } G10P { storeFile file("keystore/G10PMTK11.jks") storePassword "123456" keyAlias "G10PMTK11" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } G11Userdebug { storeFile file("keystore/G11Userdebug.keystore") storePassword "123456" keyAlias "G11Userdebug" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } G10PUserDebug { storeFile file("keystore/G10PUserDebug.jks") storePassword "123456" keyAlias "G10PUserDebug" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } Teclast8515 { storeFile file("keystore/Teclast8515.keystore") storePassword "123456" keyAlias "Teclast8515" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } P20S { storeFile file("keystore/MTKP20S.keystore") storePassword "123456" keyAlias "MTKP20S" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } U807 { storeFile file("keystore/AllwinnerU807.jks") storePassword "123456" keyAlias "u807" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } UnisocS6688 { storeFile file("keystore/UnisocS6688Userdebug.jks") storePassword "123456" keyAlias "unisocs6688userdebug" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } iPlay50P { storeFile file("keystore/iPlay50P.jks") storePassword "123456" keyAlias "iplay50p" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } Huaruian8768 { storeFile file("keystore/Huaruian8768.jks") storePassword "123456" keyAlias "Huaruian8768" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } zhanruiG10Z { storeFile file("keystore/zhanruiG10Z.keystore") storePassword "123456" keyAlias "zhanruiG10Z" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } G10ZUserDebug { storeFile file("keystore/G10zUserDebug.keystore") storePassword "123456" keyAlias "G10zUserDebug" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } seewo { storeFile file("keystore/aiud.keystore") storePassword "s4HdJuphaiHhU7WY" keyAlias "androidreleasekey" keyPassword "JwUw2oV16rUjWLBC" v1SigningEnabled true v2SigningEnabled true } U1302 { storeFile file("keystore/U1302.keystore") storePassword "123456" keyAlias "u1302" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } MT6789 { storeFile file("keystore/MT6789.keystore") storePassword "123456" keyAlias "mt6789" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } BCM310 { storeFile file("keystore/BCM310.keystore") storePassword "123456" keyAlias "bcm310" keyPassword "123456" v1SigningEnabled true v2SigningEnabled true } } buildTypes { BCM310Debug.initWith(debug) BCM310Debug { versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.BCM310 buildConfigField "String", "platform", '"HL500"' } BCM310Release.initWith(release) BCM310Release { signingConfig signingConfigs.BCM310 buildConfigField "String", "platform", '"HL500"' } MT6789Debug.initWith(debug) MT6789Debug { buildConfigField "String", "platform", '"G12NL"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.MT6789 } MT6789Release.initWith(release) MT6789Release { buildConfigField "String", "platform", '"G12NL"' signingConfig signingConfigs.MT6789 } QZ15Debug.initWith(debug) QZ15Debug { buildConfigField "String", "platform", '"QZA15"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.U1302 } QZ15Release.initWith(release) QZ15Release { buildConfigField "String", "platform", '"QZA15"' signingConfig signingConfigs.U1302 } seewoDebug.initWith(debug) seewoDebug { versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.seewo buildConfigField "String", "platform", '"seewo"' } seewoRelease.initWith(release) seewoRelease { signingConfig signingConfigs.seewo buildConfigField "String", "platform", '"seewo"' } Huaruian8768Debug.initWith(debug) Huaruian8768Debug { versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.Huaruian8768 buildConfigField "String", "platform", '"MT8768"' } Huaruian8768Release.initWith(release) Huaruian8768Release { signingConfig signingConfigs.Huaruian8768 buildConfigField "String", "platform", '"MT8768"' } iPlay50PDebug.initWith(debug) iPlay50PDebug { buildConfigField "String", "platform", '"T1102"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.iPlay50P } iPlay50PRelease.initWith(release) iPlay50PRelease { buildConfigField "String", "platform", '"T1102"' signingConfig signingConfigs.iPlay50P } UnisocS6688Debug.initWith(debug) UnisocS6688Debug { buildConfigField "String", "platform", '"S6688"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.UnisocS6688 } UnisocS6688Release.initWith(release) UnisocS6688Release { buildConfigField "String", "platform", '"S6688"' signingConfig signingConfigs.UnisocS6688 } U807Debug.initWith(debug) U807Debug { buildConfigField "String", "platform", '"U807"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.U807 } U807Release.initWith(release) U807Release { buildConfigField "String", "platform", '"U807"' signingConfig signingConfigs.U807 } tuiXinDebug.initWith(debug) tuiXinDebug { versionNameSuffix "-debug" buildConfigField "String", "platform", '"ZhanRui"' debuggable true signingConfig signingConfigs.tuixin } teclastUnisocdebug.initWith(zhanRuiDebug) teclastUnisocdebug { buildConfigField "String", "platform", '"ZhanRui"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.teclastUnisoc } teclastUnisocrelease.initWith(zhanRuiDebug) teclastUnisocrelease { buildConfigField "String", "platform", '"ZhanRui"' signingConfig signingConfigs.teclastUnisoc } teclastMTKDebug.initWith(debug) teclastMTKDebug { buildConfigField "String", "platform", '"MTK"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.teclastMTK } teclastMTKRelease.initWith(release) teclastMTKRelease { buildConfigField "String", "platform", '"MTK"' signingConfig signingConfigs.teclastMTK } G10PDebug.initWith(debug) G10PDebug { versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.G10P buildConfigField "String", "platform", '"MTK11"' } G10PRelease.initWith(release) G10PRelease { signingConfig signingConfigs.G10P buildConfigField "String", "platform", '"MTK11"' } G11Userdebug.initWith(debug) G11Userdebug { versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.G11Userdebug buildConfigField "String", "platform", '"G10P"' } G10PUserDebug.initWith(debug) G10PUserDebug { versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.G10PUserDebug buildConfigField "String", "platform", '"MTK11"' } Teclast8515Debug.initWith(debug) Teclast8515Debug { buildConfigField "String", "platform", '"8515"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.Teclast8515 } Teclast8515Release.initWith(release) Teclast8515Release { buildConfigField "String", "platform", '"8515"' signingConfig signingConfigs.Teclast8515 } TeclastP20SDebug.initWith(debug) TeclastP20SDebug { buildConfigField "String", "platform", '"P20S"' debuggable true versionNameSuffix "-debug" signingConfig signingConfigs.P20S } TeclastP20SRelease.initWith(release) TeclastP20SRelease { buildConfigField "String", "platform", '"P20S"' signingConfig signingConfigs.P20S } zhanruiG10ZUserDebug.initWith(debug) zhanruiG10ZUserDebug { versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.G10ZUserDebug buildConfigField "String", "platform", '"ZR6016"' } zhanruiG10ZDebug.initWith(debug) zhanruiG10ZDebug { versionNameSuffix "-debug" debuggable true buildConfigField "String", "platform", '"ZR6016"' signingConfig signingConfigs.zhanruiG10Z } zhanruiG10ZRelease.initWith(release) zhanruiG10ZRelease { buildConfigField "String", "platform", '"ZR6016"' signingConfig signingConfigs.zhanruiG10Z } 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 } zhanRui12Debug.initWith(debug) zhanRui12Debug { debuggable true versionNameSuffix "-debug" buildConfigField "String", "platform", '"AH6016"' signingConfig signingConfigs.zhanRui12 } zhanRui12Release.initWith(release) zhanRui12Release { buildConfigField "String", "platform", '"AH6016"' signingConfig signingConfigs.zhanRui12 } debug { buildConfigField "String", "platform", '"MTK"' versionNameSuffix "_debug" signingConfig signingConfigs.xueshibao } release { buildConfigField "String", "platform", '"MTK"' minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.xueshibao } } android.applicationVariants.all { variant -> variant.outputs.all { output -> // 改为 all def buildType = variant.buildType.name if (buildType.contains("debug")) { outputFileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk" } else { outputFileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk" } } } } dependencies { /*加了会报错,暂时注释掉*/ // implementation fileTree(dir: "libs", include: ["*.jar"]) compileOnly files('libs/framework.jar') // compileOnly files('libs/qz_cubemdm_sdk_v1.0.0_1.8.jar') compileOnly files('libs/qz_cubemdm_sdk_v1.0.1_1.8.jar') implementation project(':viewlibrary') implementation project(path: ':niceimageview') implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // activity_main.xml 直接使用了 com.suke.widget.SwitchButton,需在本模块声明依赖 implementation 'com.github.zcweng:switch-button:0.0.3@aar' 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' //内存泄漏检测 debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14' ////三方 //RxJava 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:5.4.0' //4.9.3最后一个4.x版本 //Retrofit implementation 'com.squareup.retrofit2:retrofit:3.0.0' implementation 'com.squareup.retrofit2:converter-gson:3.0.0' // implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' implementation "com.squareup.retrofit2:adapter-rxjava3:3.0.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' //MMKV implementation 'com.tencent:mmkv-static:2.4.0' //Bugly implementation 'com.tencent.bugly:crashreport:4.1.9.3' //腾讯移动推送 TPNS implementation "com.tencent.tpns:tpns:1.4.4.11-release" ////图片加载框架 //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:3.7.0' //Picasso implementation 'com.squareup.picasso:picasso:2.71828' //个人 //utilcode工具类 implementation 'com.blankj:utilcodex:1.31.1' //更换字体框架 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:3.1.0' // 圆角ImageView // implementation 'com.github.zane618:NiceImageView:1.0.0' // 权限请求框架:https://github.com/getActivity/XXPermissions implementation 'com.github.getActivity:XXPermissions:28.3' // 吐司框架:https://github.com/getActivity/Toaster implementation 'com.github.getActivity:Toaster:12.6' //动态权限框架 implementation 'com.yanzhenjie:permission:2.0.3' //沉浸状态栏 implementation 'com.gitee.zackratos:UltimateBarX:0.8.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' } // 在 dependencies 之后添加 project.afterEvaluate { android.applicationVariants.all { variant -> variant.javaCompileProvider.get().options.bootstrapClasspath = files( file('libs/framework.jar'), android.getBootClasspath() ) } }