build: 升级到agp8,studio panda4

This commit is contained in:
2026-06-27 11:32:32 +08:00
parent feb7153f07
commit 0d2d9020bc
3 changed files with 72 additions and 65 deletions

View File

@@ -1,11 +1,13 @@
buildscript { buildscript {
repositories { repositories {
google() google()
// mavenCentral() mavenCentral()
maven { url "https://jitpack.io" } maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://developer.hihonor.com/repo' }
maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/central' }
maven { url "https://maven.aliyun.com/repository/jcenter" } maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/google' }
} }
@@ -17,6 +19,31 @@ buildscript {
} }
allprojects { 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.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'
}
}
gradle.projectsEvaluated { gradle.projectsEvaluated {
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p:libs/framework.jar') options.compilerArgs.add('-Xbootclasspath/p:libs/framework.jar')
@@ -37,28 +64,9 @@ final String FRAMEWORK_PREBUILTS_DIR = "${ANDROID_TOP}/prebuilts/framework_inter
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf' apply plugin: 'com.google.protobuf'
//apply plugin: "com.tencent.android.tpns"
android { android {
// gradle.projectsEvaluated { namespace "com.aoleyun.os"
// tasks.withType(JavaCompile) {
// Set<File> fileSet = options.bootstrapClasspath.getFiles()
// List<File> newFileList = new ArrayList<>();
// //JAVA语法,可连续调用,输入参数建议为相对路径
// newFileList.add(new File("libs/framework.jar"))
// //最后将原始参数添加
// newFileList.addAll(fileSet)
// options.bootstrapClasspath = files(
// newFileList.toArray()
// )
// }
// }
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileSdkVersion COMPILE_SDK compileSdkVersion COMPILE_SDK
buildToolsVersion BUILD_TOOLS_VERSION buildToolsVersion BUILD_TOOLS_VERSION
@@ -76,10 +84,26 @@ android {
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64' // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
} }
lintOptions {
checkReleaseBuilds false
abortOnError false
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding true
buildConfig true
aidl true
}
//签名 //签名
signingConfigs { signingConfigs {
zhanRui { zhanRui {
@@ -470,9 +494,7 @@ android {
debuggable true debuggable true
versionNameSuffix "-debug" versionNameSuffix "-debug"
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
signingConfig signingConfigs.mtk signingConfig signingConfigs.mtk
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.each { output ->
@@ -487,13 +509,8 @@ android {
release { release {
buildConfigField "String", "platform", '"MTK"' buildConfigField "String", "platform", '"MTK"'
//混淆
minifyEnabled false minifyEnabled false
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
//签名
signingConfig signingConfigs.mtk signingConfig signingConfigs.mtk
//将release版本的包名重命名,加上版本及日期 //将release版本的包名重命名,加上版本及日期
applicationVariants.all { variant -> applicationVariants.all { variant ->
@@ -508,11 +525,6 @@ android {
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// The flavor dimensions for build variants (e.g. aospWithQuickstep, aospWithoutQuickstep) // The flavor dimensions for build variants (e.g. aospWithQuickstep, aospWithoutQuickstep)
// See: https://developer.android.com/studio/build/build-variants#flavor-dimensions // See: https://developer.android.com/studio/build/build-variants#flavor-dimensions
flavorDimensions "app", "recents" flavorDimensions "app", "recents"
@@ -618,12 +630,17 @@ android {
repositories { repositories {
maven { url "../../../prebuilts/fullsdk-darwin/extras/android/m2repository" } maven { url "../../../prebuilts/fullsdk-darwin/extras/android/m2repository" }
maven { url "../../../prebuilts/fullsdk-linux/extras/android/m2repository" } maven { url "../../../prebuilts/fullsdk-linux/extras/android/m2repository" }
google() google()
mavenCentral() mavenCentral()
maven { url "https://jitpack.io" } maven { url 'https://jitpack.io' }
maven { url 'http://developer.huawei.com/repo/' } maven { url 'https://maven.google.com' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'https://developer.huawei.com/repo/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' } maven { url 'https://developer.hihonor.com/repo' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
} }
dependencies { dependencies {
@@ -668,7 +685,7 @@ dependencies {
//磁盘缓存 //磁盘缓存
implementation 'com.jakewharton:disklrucache:2.0.2' implementation 'com.jakewharton:disklrucache:2.0.2'
//mmkv //mmkv
implementation 'com.tencent:mmkv-static:1.2.13' implementation 'com.tencent:mmkv-static:2.4.0'
// //腾讯移动推送 TPNS // //腾讯移动推送 TPNS
// implementation 'com.tencent.tpns:tpns:1.3.2.0-release' // implementation 'com.tencent.tpns:tpns:1.3.2.0-release'
// //阿里云推送 // //阿里云推送
@@ -677,31 +694,19 @@ dependencies {
implementation 'me.laoyuyu.aria:core:3.8.16' implementation 'me.laoyuyu.aria:core:3.8.16'
annotationProcessor 'me.laoyuyu.aria:compiler:3.8.16' annotationProcessor 'me.laoyuyu.aria:compiler:3.8.16'
//工具类 //工具类
implementation 'com.blankj:utilcodex:1.31.0' implementation 'com.blankj:utilcodex:1.31.1'
// 吐司框架:https://github.com/getActivity/Toaster // 吐司框架:https://github.com/getActivity/Toaster
implementation 'com.github.getActivity:Toaster:12.6' implementation 'com.github.getActivity:Toaster:12.6'
} }
preBuild { // 在 dependencies 之后添加
doLast { project.afterEvaluate {
def imlFile = file(project.name + ".iml") android.applicationVariants.all { variant ->
println 'Change ' + project.name + '.iml order' variant.javaCompileProvider.get().options.bootstrapClasspath = files(
try { file('libs/framework.jar'),
def parsedXml = (new XmlParser()).parse(imlFile) android.getBootClasspath()
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
} }
protobuf { protobuf {

View File

@@ -4,10 +4,10 @@ android.enableJetifier = true
ANDROID_X_VERSION=1.0.0-beta01 ANDROID_X_VERSION=1.0.0-beta01
GRADLE_CLASS_PATH=com.android.tools.build:gradle:3.3.0 GRADLE_CLASS_PATH=com.android.tools.build:gradle:8.13.2
PROTOBUF_CLASS_PATH=com.google.protobuf:protobuf-gradle-plugin:0.8.8 PROTOBUF_CLASS_PATH=com.google.protobuf:protobuf-gradle-plugin:0.9.4
PROTOBUF_DEPENDENCY=com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7 PROTOBUF_DEPENDENCY=com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7
BUILD_TOOLS_VERSION=28.0.3 BUILD_TOOLS_VERSION=36.0.0
COMPILE_SDK=android-29 COMPILE_SDK=android-29

View File

@@ -1,6 +1,8 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
namespace "com.aoleyun.os.icons"
compileSdkVersion COMPILE_SDK compileSdkVersion COMPILE_SDK
buildToolsVersion BUILD_TOOLS_VERSION buildToolsVersion BUILD_TOOLS_VERSION
publishNonDefault true publishNonDefault true