apply plugin: 'com.android.application' static def appName() { return "设备绑定" } static def releaseTime() { return new Date().format("yyyyMMdd-HHmmss", TimeZone.getDefault()) } android { compileSdkVersion 29 buildToolsVersion "29.0.3" defaultConfig { applicationId "com.uiuipad.find" minSdkVersion 24 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true ndk { //选择要添加的对应 cpu 类型的 .so 库。 abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', "x86" // 还可以添加 '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 } dexOptions { jumboMode true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } //签名 signingConfigs { //iPlay50 mini,iPlay50 android13 共用签名 iPlay50mini { storeFile file("keystore/iPlay50Mini.keystore") storePassword "android" keyAlias "platform" keyPassword "android" v2SigningEnabled false } } buildTypes { debug { versionNameSuffix "-debug" debuggable true //Zipalign优化 zipAlignEnabled true minifyEnabled false signingConfig signingConfigs.iPlay50mini applicationVariants.all { variant -> variant.outputs.each { output -> if (outputFile != null) { def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" output.outputFileName = fileName } } } } release { //Zipalign优化 zipAlignEnabled true //混淆 minifyEnabled false //前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //签名 signingConfig signingConfigs.iPlay50mini // 将release版本的包名重命名,加上版本及日期 applicationVariants.all { variant -> variant.outputs.each { output -> def outputFile = "" if (outputFile != null) { def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" output.outputFileName = new File(outputFile, fileName) } } } } } } dependencies { // implementation fileTree(dir: 'libs', include: ['*.jar']) compileOnly files('libs/framework.jar') implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' //BindView 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' //okhttp implementation 'com.squareup.okhttp3:okhttp:4.10.0' //Retrofit implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0' //RxJava implementation 'io.reactivex.rxjava3:rxjava:3.0.0' implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' //生命周期管理 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' //Google implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.google.zxing:core:3.5.0' //图片加载框架 implementation 'com.github.bumptech.glide:glide:4.15.1' annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1' //MMKV implementation 'com.tencent:mmkv-static:1.2.14' //阿里云推送 implementation 'com.aliyun.ams:alicloud-android-push:3.8.0' //百度地图 implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.1.8' //工具类 implementation 'com.blankj:utilcodex:1.31.0' //沉浸状态栏 implementation 'com.gitee.zackratos:UltimateBarX:0.8.0' implementation 'com.jakewharton.rxbinding2:rxbinding:2.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/ //使用系统编译后的framework.jar }