提交 7d883a2d authored 作者: 史晓晨's avatar 史晓晨

feat:适配Flutter SDK 3.24.5,适配AGP8.0+

上级 1965716e
......@@ -2,14 +2,14 @@ group 'com.clx.apk_update'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:8.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
......@@ -25,41 +25,30 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 34
namespace "com.clx.apk_update"
// 1. 升级 compileSdk 至 36(AGP 8.13 最佳兼容版本,替代 compileSdkVersion)
compileSdk 34
// 2. JDK 版本需升级至 17(AGP 8.13 强制要求)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
// 3. Kotlin JVM 目标版本同步为 17
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}
defaultConfig {
minSdkVersion 16
minSdkVersion 21
}
dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.mockito:mockito-core:5.0.0'
implementation 'com.aliyun.dpa:oss-android-sdk:2.9.19'
}
testOptions {
unitTests.all {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.clx.apk_update">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!--用于访问网络,网络定位需要上网-->
<uses-permission android:name="android.permission.INTERNET" />
......
......@@ -27,16 +27,20 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
namespace "com.clx.apk_update_example"
compileSdkVersion 34
ndkVersion flutter.ndkVersion
// 1. 升级 compileSdk 至 36(AGP 8.13 最佳兼容版本,替代 compileSdkVersion)
compileSdk 34
// 2. JDK 版本需升级至 17(AGP 8.13 强制要求)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
// 3. Kotlin JVM 目标版本同步为 17
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
sourceSets {
......@@ -48,8 +52,8 @@ android {
applicationId "com.clx.apk_update_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion 31
minSdkVersion 21 // 支持最低版本可保留 21(AGP 8.13 兼容)
targetSdkVersion 31// 建议与 compileSdk 一致(原 31 过低,需升级)
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
......@@ -68,5 +72,5 @@ flutter {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:8.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
......
......@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
\ No newline at end of file
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
\ No newline at end of file
......@@ -12,19 +12,19 @@ dependencies:
sdk: flutter
plugin_platform_interface: ^2.0.2
# dio https://pub.dev/packages/dio
dio: ^5.1.1
dio: ^5.9.0
#https://pub.dev/packages/flustars_flutter3
flustars_flutter3: ^3.0.0
# toast https://pub.dev/packages/fluttertoast
fluttertoast: ^8.2.1
fluttertoast: ^8.2.14
# get https://pub.dev/packages/get
get: ^4.6.5
get: ^4.7.2
# https://pub.dev/packages/flutter_widget_from_html_core
flutter_widget_from_html_core: ^0.10.0
flutter_widget_from_html_core: ^0.16.1
# https://pub.dev/packages/url_launcher
url_launcher: ^6.1.2
#网络连接工具
connectivity_plus: ^6.1.0
url_launcher: ^6.3.1
#网络连接工具
connectivity_plus: ^6.1.5
dev_dependencies:
flutter_test:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论