style: 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-05-08 16:57:42 +08:00
parent 4dcb82b9f4
commit 6baa7155ba
7 changed files with 89 additions and 81 deletions

View File

@@ -9,7 +9,9 @@ static def releaseTime() {
}
android {
compileSdkVersion 29
namespace "com.ttstd.dialer"
compileSdkVersion 33
// buildToolsVersion "36.0.0"
defaultConfig {
@@ -17,7 +19,7 @@ android {
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 22
targetSdkVersion 29
targetSdkVersion 33
versionCode 1
versionName "1.0"
@@ -27,11 +29,6 @@ android {
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
ndk {
//根据需要 自行选择添加的对应cpu类型的.so库。
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
@@ -51,22 +48,12 @@ android {
}
}
dataBinding {
enabled true
}
sourceSets {
main {
jniLibs.srcDir(['libs'])
}
}
repositories {
flatDir {
dirs 'libs'
}
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "d779178d9900d4fb5d633678", //JPush 上注册的包名对应的 Appkey.
@@ -85,6 +72,16 @@ android {
]
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding true
buildConfig true
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
@@ -144,14 +141,6 @@ android {
//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 {
@@ -159,22 +148,27 @@ android {
//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)
}
}
}
}
}
// 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
}
}
}
ext {
@@ -287,7 +281,7 @@ dependencies {
// 接入魅族厂商
implementation "cn.jiguang.sdk.plugin:meizu:$jpush.version"
// JPush Android SDK v5.2.3 开始,需要单独引入 魅族 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/meizu/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
implementation(name: 'push-internal-5.0.5', ext: 'aar')
implementation files('libs/push-internal-5.0.5.aar')
// 接入 VIVO 厂商
implementation "cn.jiguang.sdk.plugin:vivo:$jpush.version"
// 接入小米厂商
@@ -295,7 +289,7 @@ dependencies {
// 接入 OPPO 厂商
implementation "cn.jiguang.sdk.plugin:oppo:$jpush.version"
// JPush Android SDK v4.6.0 开始,需要单独引入 oppo 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/oppo/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
implementation(name: 'com.heytap.msp_V3.7.1', ext: 'aar')
implementation files('libs/com.heytap.msp_V3.7.1.aar')
//以下为 OPPO 3.1.0 aar需要依赖
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'commons-codec:commons-codec:1.6'
@@ -303,11 +297,11 @@ dependencies {
// 接入荣耀厂商
implementation "cn.jiguang.sdk.plugin:honor:$jpush.version"
//需要单独引入荣耀厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
implementation(name: 'HiPushSDK-8.0.12.307', ext: 'aar')
implementation files('libs/HiPushSDK-8.0.12.307.aar')
// 接入蔚来厂商
implementation "cn.jiguang.sdk.plugin:nio:$jpush.version"
//JPush Android SDK v5.6.0 开始需要单独引入蔚来厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/nio/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
implementation(name: 'niopush-sdk-v1.0', ext: 'aar')
implementation files('libs/niopush-sdk-v1.0.aar')
//地图组件
@@ -343,28 +337,37 @@ dependencies {
}
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
//}

View File

@@ -6,16 +6,17 @@ buildscript {
repositories {
google()
// 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://maven.google.com" }
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/jcenter' }
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
@@ -24,21 +25,22 @@ buildscript {
}
allprojects {
configurations.all {
resolutionStrategy {
force 'androidx.constraintlayout:constraintlayout:2.0.4'
force 'androidx.annotation:annotation:1.1.0'
}
}
// configurations.all {
// resolutionStrategy {
// force 'androidx.constraintlayout:constraintlayout:2.0.4'
// force 'androidx.annotation:annotation:1.1.0'
// }
// }
repositories {
google()
// 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://maven.google.com" }
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/jcenter' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
}

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

View File

@@ -1,6 +1,8 @@
apply plugin: 'com.android.library'
android {
namespace "com.ttstd.iconloader"
compileSdkVersion 36
// buildToolsVersion "36.0.0"

View File

@@ -1 +1 @@
<manifest package="com.ttstd.iconloader" />
<manifest />

View File

@@ -1,6 +1,8 @@
apply plugin: 'com.android.library'
android {
namespace "com.shehuan.niv"
compileSdkVersion 28
defaultConfig {

View File

@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shehuan.niv" />
<manifest />