plugins { id 'com.android.application' } android { compileSdk 31 defaultConfig { applicationId "com.wisewoods.edunative" minSdk 24 targetSdk 28 versionCode getMyAppVersionCode() versionName getMyAppVersionName() multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildFeatures { viewBinding = true } ndk { abiFilters "armeabi", "armeabi-v7a", "arm64-v8a" } manifestPlaceholders = [ XG_ACCESS_ID : "1500026201", XG_ACCESS_KEY: "AYRKBUX8G6AK", ] } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } // 设置发布版的签名 signingConfigs { debug { storeFile file('./edunative.jks') keyAlias 'edunative' storePassword 'edunative' keyPassword 'edunative' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } packagingOptions { jniLibs { keepDebugSymbols += ['*/armeabi/libYTCommon.so', '*/armeabi-v7a/libYTCommon.so', '*/x86/libYTCommon.so', '*/arm64-v8a/libYTCommon.so'] pickFirsts += ['**/libc++_shared.so'] } } } dependencies { implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') implementation project(path: ':base') implementation 'com.github.azhon:AppUpdate:3.0.5' implementation 'com.qcloud.cos:cos-android:5.7.3' implementation 'com.tencent.tpns:tpns:1.2.7.1-release' implementation 'io.github.youth5201314:banner:2.2.2' implementation 'com.pgyer:analytics:4.2.0' implementation 'com.tsy.social:social-sdk-core:2.0.0' implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5' implementation 'com.tencent.liteav:LiteAVSDK_TRTC:9.5.11207' implementation 'com.tencent.imsdk:imsdk-plus:6.0.1992' implementation 'xyz.doikki.android.dkplayer:dkplayer-java:3.3.5' implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.5' implementation 'xyz.doikki.android.dkplayer:videocache:3.3.5' implementation 'xyz.doikki.android.dkplayer:player-exo:3.3.5' implementation 'com.google.android.flexbox:flexbox:3.0.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } task updateVersionCode(){ doFirst{ // 获取 gradle.properties 文件 def gradleProperties = file('../version.properties') // 读取里面的键值对 def properties = new Properties() properties.load(new FileInputStream(gradleProperties)) // 获取里面的 APP_VERSION_CODE 进行 +1 def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1 // 重新赋值 properties['APP_VERSION_CODE'] = codeBumped.toString() // 写入 properties.store(gradleProperties.newWriter(), null) } } project.tasks.whenTaskAdded { Task theTask -> if (theTask.name == 'assembleRelease' || theTask.name == 'assembleDebug') { theTask.dependsOn(updateVersionCode) theTask.mustRunAfter(updateVersionCode) // updateVersionCode在assembleRelease之前执行 } } //preBuild.dependsOn(updateVersionCode) def getMyAppVersionCode() { //获取APP版本号 def gradleProperties = file('../version.properties') def properties = new Properties() properties.load(new FileInputStream(gradleProperties)) def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1 return codeBumped as int } def getMyAppVersionName() { //获取APP版本号 def gradleProperties = file('../version.properties') def properties = new Properties() properties.load(new FileInputStream(gradleProperties)) def codeBumped = properties['APP_VERSION_CODE'].toInteger() + 1 return "1.0."+codeBumped }