Skip to content

Commit fe72fa5

Browse files
committed
fix(agp):use plugin DSL
1 parent a0bb892 commit fe72fa5

File tree

2 files changed

+20
-33
lines changed

2 files changed

+20
-33
lines changed

android/app/build.gradle

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
plugins {
2-
id "com.android.application"
3-
id "kotlin-android"
4-
id "kotlin-parcelize"
5-
id "kotlin-kapt"
6-
id "dev.flutter.flutter-gradle-plugin"
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
id 'kotlin-parcelize'
5+
id 'kotlin-kapt'
6+
id 'org.jetbrains.kotlin.plugin.serialization'
7+
id 'dev.flutter.flutter-gradle-plugin'
78
}
89

9-
apply plugin: 'kotlinx-serialization'
10-
1110
def pro = new Properties()
1211
def localPropertiesFile = rootProject.file('local.properties')
1312
if (localPropertiesFile.exists()) {
@@ -116,6 +115,7 @@ android {
116115
}
117116
}
118117

118+
// 使用 AGP 8 推荐方式重写变体输出命名
119119
androidComponents {
120120
onVariants { variant ->
121121
variant.outputs.forEach { output ->
@@ -134,15 +134,10 @@ androidComponents {
134134
flutter {
135135
source '../..'
136136
}
137-
////获取flutter的sdk路径
138-
//def flutterRoot = localProperties.getProperty('flutter.sdk')
139-
//if (flutterRoot == null) {
140-
// throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
141-
//}
137+
142138
dependencies {
143139
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
144140

145-
// compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar")
146141
implementation project(":utils")
147142
//noinspection GradleDependency
148143
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'

android/build.gradle

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
1-
buildscript {
2-
ext{
3-
kotlin_version = '1.9.21'
4-
agp_version = '8.11.1'
5-
room_version = '2.6.1'
6-
ksp_version = '1.9.21-1.0.16'
7-
}
8-
9-
10-
repositories {
11-
google()
12-
mavenCentral()
13-
}
14-
15-
dependencies {
16-
classpath "com.android.tools.build:gradle:$agp_version"
17-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18-
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
19-
}
1+
plugins {
2+
id 'com.android.application' version '8.11.1' apply false
3+
id 'com.android.library' version '8.11.1' apply false
4+
id 'org.jetbrains.kotlin.android' version '1.9.21' apply false
5+
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.21' apply false
206
}
217

8+
ext{
9+
kotlin_version = '1.9.21'
10+
agp_version = '8.11.1'
11+
room_version = '2.6.1'
12+
ksp_version = '1.9.21-1.0.16'
13+
}
2214

2315
allprojects {
2416
repositories {
@@ -38,4 +30,4 @@ subprojects {
3830

3931
tasks.register("clean", Delete) {
4032
delete rootProject.buildDir
41-
}
33+
}

0 commit comments

Comments
 (0)