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.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 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", ] } 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("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 } } buildTypes { 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 } 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"' // 不显示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' ////三方 //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: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' //Bugly implementation 'com.tencent.bugly:crashreport:4.0.0' //腾讯移动推送 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 }