From 0a57018972bc748f7cc5cc01d35e48b3b01c147d Mon Sep 17 00:00:00 2001 From: tongtongstudio Date: Tue, 28 Jul 2026 11:50:10 +0800 Subject: [PATCH] build: update agp android gradle version update agp to 8.13.2,update gradle to 8.13,add build.gradle namespace --- app/build.gradle | 68 +++++++++++------------- build.gradle | 23 +++++++- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b066ab3..219a6f0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,10 @@ def releaseTime() { } android { + namespace "com.ttstd.elderlyassistant" + compileSdkVersion 29 -// buildToolsVersion "30.0.3" + buildToolsVersion "36.0.0" defaultConfig { applicationId "com.ttstd.elderlyassistant" @@ -22,6 +24,12 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + ndk { + //根据需要 自行选择添加的对应cpu类型的.so库。 + abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + // 还可以添加 'armeabi','armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64' + } + lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, @@ -29,20 +37,17 @@ android { abortOnError false } - ndk { - //根据需要 自行选择添加的对应cpu类型的.so库。 - abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' - // 还可以添加 'armeabi','armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64' - } + } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } - dataBinding { - enabled true - } + buildFeatures { + dataBinding true + buildConfig true + aidl true } signingConfigs { @@ -59,36 +64,25 @@ android { versionNameSuffix "_debug" debuggable true minifyEnabled false - //Zipalign优化 - zipAlignEnabled true signingConfig signingConfigs.keypub - applicationVariants.all { variant -> - variant.outputs.each { output -> - if (outputFile != null) { - def fileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk" - output.outputFileName = fileName - } - } - } } release { minifyEnabled false - //Zipalign优化 - zipAlignEnabled true //前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件 - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - //签名 + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.keypub -// 将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) - } - } + } + } + + applicationVariants.all { variant -> + variant.outputs.each { output -> + def buildType = variant.buildType.name + + if (buildType.contains("debug")) { + output.outputFileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk" + } else { + output.outputFileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk" } } } @@ -134,7 +128,7 @@ dependencies { implementation 'com.jeremyliao:live-event-bus-x:1.7.3' //MMKV - implementation 'com.tencent:mmkv-static:1.2.14' + implementation 'com.tencent:mmkv-static:2.4.0' //bugly implementation 'com.tencent.bugly:crashreport:4.1.9.2' implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.0.0' diff --git a/build.gradle b/build.gradle index d846304..f5a4bae 100644 --- a/build.gradle +++ b/build.gradle @@ -15,8 +15,7 @@ buildscript { maven { url 'https://maven.aliyun.com/repository/google' } } dependencies { - classpath 'com.android.tools.build:gradle:3.6.4' - + classpath 'com.android.tools.build:gradle:8.13.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -27,7 +26,27 @@ allprojects { configurations.all { resolutionStrategy { force 'androidx.constraintlayout:constraintlayout:2.0.4' + force 'androidx.core:core:1.5.0' + + //for targetSdkVersion 29 + force 'androidx.activity:activity:1.2.2' force 'androidx.appcompat:appcompat:1.3.1' + force 'androidx.lifecycle:lifecycle-livedata:2.3.1' + force 'androidx.lifecycle:lifecycle-livedata-core:2.3.1' + force 'androidx.lifecycle:lifecycle-runtime:2.3.1' + force 'androidx.lifecycle:lifecycle-viewmodel:2.3.1' + force 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1' + force 'androidx.lifecycle:lifecycle-service:2.3.1' + force 'androidx.lifecycle:lifecycle-process:2.3.1' + force 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' + force 'androidx.savedstate:savedstate:1.1.0' + force 'androidx.profileinstaller:profileinstaller:1.1.0' + force 'androidx.startup:startup-runtime:1.0.0' + force 'androidx.arch.core:core-runtime:2.1.0' + force 'androidx.sqlite:sqlite:2.1.0' + force 'androidx.sqlite:sqlite-framework:2.1.0' + force 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' + } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a54eab6..4473637 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip