build: update agp android gradle version

update agp to 8.13.2,update gradle to 8.13,add build.gradle namespace
This commit is contained in:
2026-06-24 19:09:30 +08:00
parent 6c10b094ce
commit 9e8dbd3566
8 changed files with 155 additions and 110 deletions

View File

@@ -9,23 +9,10 @@ static def releaseTime() {
}
android {
//Android Studio 4.0 之后使用这个但是会把jar打包进apk
// gradle.projectsEvaluated {
// 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()
// )
// }
// }
namespace "com.aoleyun.sn"
compileSdkVersion 29
buildToolsVersion "30.0.3"
buildToolsVersion "36.0.0"
defaultConfig {
applicationId "com.aoleyun.sn"
@@ -44,6 +31,13 @@ android {
// 还可以添加 'armeabi', 'armeabi-v7a', 'arm64-v8a', '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
}
buildConfigField "String", "ROOT_URL", '"https://led.aoleyun.cn/api/"'
buildConfigField "String", "SCREEN_BASE_URL", '"https://led.aoleyun.cn:2018/"'
buildConfigField "String", "SCREEN_URL", '"https://led.aoleyun.cn:2018/wm/is_online"'
@@ -51,22 +45,17 @@ android {
}
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
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding true
buildConfig true
aidl true
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
@@ -226,6 +215,15 @@ android {
v2SigningEnabled true
}
BCM310 {
storeFile file("keystore/BCM310.keystore")
storePassword "123456"
keyAlias "bcm310"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
P50 {
storeFile file("keystore/P50TD.jks")
storePassword "123456"
@@ -408,6 +406,20 @@ android {
buildConfigField "String", "platform", '"HL500"'
}
BCM310Debug.initWith(debug)
BCM310Debug {
versionNameSuffix "-debug"
debuggable true
signingConfig signingConfigs.BCM310
buildConfigField "String", "platform", '"HL500"'
}
BCM310Release.initWith(release)
BCM310Release {
signingConfig signingConfigs.BCM310
buildConfigField "String", "platform", '"HL500"'
}
AiUduDebug.initWith(debug)
AiUduDebug {
versionNameSuffix "-debug"
@@ -654,18 +666,9 @@ android {
debuggable true
versionNameSuffix "-debug"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
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
}
}
}
signingConfig signingConfigs.mtk
buildConfigField "String", "platform", '"MTK"'
}
@@ -674,23 +677,30 @@ android {
//混淆
minifyEnabled false
//前一部分代表系统默认的android程序的混淆文件该文件已经包含了基本的混淆声明后一个文件是自己的定义混淆文件
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
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
}
}
}
signingConfig signingConfigs.mtk
buildConfigField "String", "platform", '"MTK"'
}
}
// Add application variant configuration here instead
applicationVariants.all { variant ->
variant.outputs.each { output ->
def buildType = variant.buildType.name
def fileName = ""
if (buildType.contains("debug")) {
fileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk"
} else {
fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
}
output.outputFileName = fileName
}
}
}
dependencies {
@@ -792,27 +802,37 @@ dependencies {
implementation 'com.github.getActivity:Toaster:12.6'
}
preBuild {
doLast {
def imlFile = file(project.name + ".iml")
// def imlFile = file("..\\.idea\\modules\\" + project.name + "\\" + rootProject.name + "." + 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"
}
// 在 dependencies 之后添加
project.afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompileProvider.get().options.bootstrapClasspath = files(
file('libs/framework.jar'),
android.getBootClasspath()
)
}
//https://www.pianshen.com/article/93481144911/
//https://blog.csdn.net/dhl_1986/article/details/102856026
//https://blog.csdn.net/zhonghe1114/article/details/80923730
//https://blog.csdn.net/u014175785/article/details/116235760
//使用系统编译后的framework.jar
}
//preBuild {
// doLast {
// def imlFile = file(project.name + ".iml")
//// def imlFile = file("..\\.idea\\modules\\" + project.name + "\\" + rootProject.name + "." + 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
// //https://blog.csdn.net/zhonghe1114/article/details/80923730
// //https://blog.csdn.net/u014175785/article/details/116235760
// //使用系统编译后的framework.jar
//}

Binary file not shown.

View File

@@ -305,7 +305,7 @@
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<!-- <action android:name="android.intent.action.PACKAGE_CHANGED" />-->
<data android:scheme="package" />
</intent-filter>

View File

@@ -59,12 +59,12 @@ public class NewAppReceiver extends BroadcastReceiver {
JgyUtils.getInstance().checkAoleyunApp();
state = "卸载了:";
break;
case Intent.ACTION_PACKAGE_CHANGED:
// 判断是禁用还是启用
boolean isDisabled = ApkUtils.isDisable(mContext, packageName);
JgyUtils.getInstance().checkAoleyunApp();
state = (isDisabled ? "禁用:" : "启用:");
break;
// case Intent.ACTION_PACKAGE_CHANGED:
// // 判断是禁用还是启用
// boolean isDisabled = ApkUtils.isDisable(mContext, packageName);
// JgyUtils.getInstance().checkAoleyunApp();
// state = (isDisabled ? "禁用:" : "启用:");
// break;
default:
state = "未知:";
break;

View File

@@ -1,5 +1,32 @@
package com.aoleyun.sn.service;
import static android.os.BatteryManager.BATTERY_HEALTH_COLD;
import static android.os.BatteryManager.BATTERY_HEALTH_DEAD;
import static android.os.BatteryManager.BATTERY_HEALTH_GOOD;
import static android.os.BatteryManager.BATTERY_HEALTH_OVERHEAT;
import static android.os.BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE;
import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN;
import static android.os.BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE;
import static android.os.BatteryManager.BATTERY_PLUGGED_AC;
import static android.os.BatteryManager.BATTERY_PLUGGED_ANY;
import static android.os.BatteryManager.BATTERY_PLUGGED_USB;
import static android.os.BatteryManager.BATTERY_PLUGGED_WIRELESS;
import static android.os.BatteryManager.BATTERY_STATUS_CHARGING;
import static android.os.BatteryManager.BATTERY_STATUS_DISCHARGING;
import static android.os.BatteryManager.BATTERY_STATUS_FULL;
import static android.os.BatteryManager.BATTERY_STATUS_NOT_CHARGING;
import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
import static android.os.BatteryManager.EXTRA_HEALTH;
import static android.os.BatteryManager.EXTRA_LEVEL;
import static android.os.BatteryManager.EXTRA_MAX_CHARGING_CURRENT;
import static android.os.BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE;
import static android.os.BatteryManager.EXTRA_PLUGGED;
import static android.os.BatteryManager.EXTRA_SCALE;
import static android.os.BatteryManager.EXTRA_STATUS;
import static android.os.BatteryManager.EXTRA_TECHNOLOGY;
import static android.os.BatteryManager.EXTRA_TEMPERATURE;
import static android.os.BatteryManager.EXTRA_VOLTAGE;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -70,33 +97,6 @@ import retrofit2.Retrofit;
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import static android.os.BatteryManager.BATTERY_HEALTH_COLD;
import static android.os.BatteryManager.BATTERY_HEALTH_DEAD;
import static android.os.BatteryManager.BATTERY_HEALTH_GOOD;
import static android.os.BatteryManager.BATTERY_HEALTH_OVERHEAT;
import static android.os.BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE;
import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN;
import static android.os.BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE;
import static android.os.BatteryManager.BATTERY_PLUGGED_AC;
import static android.os.BatteryManager.BATTERY_PLUGGED_ANY;
import static android.os.BatteryManager.BATTERY_PLUGGED_USB;
import static android.os.BatteryManager.BATTERY_PLUGGED_WIRELESS;
import static android.os.BatteryManager.BATTERY_STATUS_CHARGING;
import static android.os.BatteryManager.BATTERY_STATUS_DISCHARGING;
import static android.os.BatteryManager.BATTERY_STATUS_FULL;
import static android.os.BatteryManager.BATTERY_STATUS_NOT_CHARGING;
import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
import static android.os.BatteryManager.EXTRA_HEALTH;
import static android.os.BatteryManager.EXTRA_LEVEL;
import static android.os.BatteryManager.EXTRA_MAX_CHARGING_CURRENT;
import static android.os.BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE;
import static android.os.BatteryManager.EXTRA_PLUGGED;
import static android.os.BatteryManager.EXTRA_SCALE;
import static android.os.BatteryManager.EXTRA_STATUS;
import static android.os.BatteryManager.EXTRA_TECHNOLOGY;
import static android.os.BatteryManager.EXTRA_TEMPERATURE;
import static android.os.BatteryManager.EXTRA_VOLTAGE;
/**
* 守护进程 双进程通讯
*
@@ -258,7 +258,7 @@ public class GuardService extends Service {
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
// filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addDataScheme("package");
registerReceiver(mNewAppReceiver, filter);
}

View File

@@ -451,9 +451,9 @@ public class MainService extends BaseService implements NetworkUtils.OnNetworkSt
setStatusbar();
setFloatingWindow();
JgyUtils.getInstance().writeAppPackageList();
mNotificationManagerCompat = NotificationManagerCompat.from(this);
createNotificationChannel();
sendSimpleNotification();
// mNotificationManagerCompat = NotificationManagerCompat.from(this);
// createNotificationChannel();
// sendSimpleNotification();
// aliyunPushInit();

View File

@@ -1,10 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '2.3.21'
repositories {
google()
// mavenCentral()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://developer.hihonor.com/repo' }
maven { url 'https://maven.aliyun.com/repository/central' }
@@ -12,8 +15,9 @@ buildscript {
maven { url 'https://maven.aliyun.com/repository/public' }
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
@@ -24,13 +28,33 @@ 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'
}
}
repositories {
google()
// mavenCentral()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://developer.hihonor.com/repo' }
maven { url 'https://maven.aliyun.com/repository/central' }
@@ -38,6 +62,7 @@ allprojects {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p:app/libs/framework.jar')

View File

@@ -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-bin.zip