Skip to content

Commit e3ee1a3

Browse files
committedNov 24, 2024·
适配AGP 8
1 parent 1e09534 commit e3ee1a3

File tree

9 files changed

+49
-61
lines changed

9 files changed

+49
-61
lines changed
 

‎android/app/build.gradle

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,12 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
14-
1515
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1616
if (flutterVersionCode == null) {
1717
flutterVersionCode = '1'
@@ -22,21 +22,13 @@ if (flutterVersionName == null) {
2222
flutterVersionName = '1.0'
2323
}
2424

25-
apply plugin: 'com.android.application'
26-
apply plugin: 'kotlin-android'
27-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
28-
2925
def keystorePropertiesFile = rootProject.file("app/key.properties")
3026
def keystoreProperties = new Properties()
3127
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
3228

3329
android {
3430
compileSdkVersion 34
3531

36-
lintOptions {
37-
disable 'InvalidPackage'
38-
}
39-
4032
defaultConfig {
4133
applicationId "com.weilu.deer"
4234
minSdkVersion 21
@@ -73,8 +65,12 @@ android {
7365
}
7466

7567
compileOptions {
76-
sourceCompatibility JavaVersion.VERSION_11
77-
targetCompatibility JavaVersion.VERSION_11
68+
sourceCompatibility JavaVersion.VERSION_17
69+
targetCompatibility JavaVersion.VERSION_17
70+
}
71+
namespace 'com.weilu.deer'
72+
lint {
73+
disable 'InvalidPackage'
7874
}
7975
}
8076

@@ -83,5 +79,5 @@ flutter {
8379
}
8480

8581
dependencies {
86-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
82+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20"
8783
}

‎android/app/src/debug/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.weilu.deer">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- Flutter needs it to communicate with the running application
43
to allow setting breakpoints, to provide hot reload, etc.
54
-->

‎android/app/src/main/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.weilu.deer">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
54
<uses-permission android:name="android.permission.INTERNET"/>

‎android/app/src/profile/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.weilu.deer">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- Flutter needs it to communicate with the running application
43
to allow setting breakpoints, to provide hot reload, etc.
54
-->

‎android/build.gradle

-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = '1.7.0'
3-
repositories {
4-
maven { url 'https://maven.aliyun.com/repository/public' }//jcenter
5-
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }//gradle-plugin
6-
maven { url 'https://maven.aliyun.com/repository/central' }//central
7-
maven { url 'https://maven.aliyun.com/repository/google' }//google
8-
google()
9-
mavenCentral()
10-
maven { url 'https://jitpack.io' }
11-
}
12-
13-
dependencies {
14-
classpath 'com.android.tools.build:gradle:7.4.2'
15-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16-
}
17-
}
18-
191
allprojects {
202
repositories {
213
maven { url 'https://maven.aliyun.com/repository/public' }

‎android/gradle.properties

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ kotlin.incremental=true
1515
kotlin.incremental.java=true
1616
kotlin.incremental.js=true
1717
kotlin.caching.enabled=true
18-
kotlin.parallel.tasks.in.project=true
18+
kotlin.parallel.tasks.in.project=true
19+
android.defaults.buildfeatures.buildconfig=true
20+
android.nonTransitiveRClass=false
21+
android.nonFinalResIds=false
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Sep 13 21:08:20 CST 2020
1+
#Sat Nov 23 15:18:48 CST 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip

‎android/settings.gradle

+20-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
411

5-
def plugins = new Properties()
6-
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7-
if (pluginsFile.exists()) {
8-
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
917
}
1018

11-
plugins.each { name, path ->
12-
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13-
include ":$name"
14-
project(":$name").projectDir = pluginDirectory
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.3.1" apply false
22+
id "org.jetbrains.kotlin.android" version "1.8.20" apply false
1523
}
24+
25+
include ":app"

‎pubspec.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,30 @@ dependencies:
5454
# 状态管理 https://github.com/rrousselGit/provider
5555
provider: ^6.1.2
5656
# 扫码 https://github.com/juliuscanute/qr_code_scanner
57-
qr_code_scanner: 1.0.0
58-
# git:
59-
# url: https://github.com/xeinebiu/qr_code_scanner.git
60-
# ref: fix_break_changes_platform
57+
qr_code_scanner:
58+
git:
59+
url: 'https://github.com/NeverOvO/qr_code_scanner.git'
60+
ref: '3fe7b88'
6161
# App Shortcuts https://github.com/flutter/packages/tree/main/packages/quick_actions
6262
quick_actions: 1.0.7
6363
# 振动 https://github.com/benjamindean/flutter_vibration
6464
vibration: 2.0.0
6565
vibration_web: 1.6.8
6666
# 获取当前设备信息 https://github.com/fluttercommunity/plus_plugins/tree/main/packages/device_info_plus
67-
device_info_plus: 10.0.1
67+
device_info_plus: 11.1.1
6868
# 桌面应用调整窗口的大小和位置 https://github.com/leanflutter/window_manager
6969
window_manager: 0.4.0
7070
# 高德2D地图插件(支持Web) https://github.com/simplezhli/flutter_2d_amap
7171
flutter_2d_amap:
7272
git:
73-
ref: '3850a4dc'
73+
ref: '0105ceae'
7474
url: 'https://github.com/simplezhli/flutter_2d_amap.git'
7575
# demo 用到的库
7676
# 刮刮卡 https://github.com/vintage/scratcher
7777
scratcher: ^2.5.0
7878
# 动画效果 https://github.com/xvrh/lottie-flutter
7979
lottie: ^3.1.2
80-
win32: 5.5.1
80+
win32: 5.5.3
8181

8282
# https://github.com/simplezhli/flutter_deer/issues/187
8383
dependency_overrides:

0 commit comments

Comments
 (0)
Please sign in to comment.