Skip to content

Commit ac16baa

Browse files
Downgrade AGP to 8.3.0
With 8.8.8, ./gradlew just exits 1 with no log. I run `flutter create` and saw that it uses AGP 8.3.0. I switched to 8.3.0 and it worked.
1 parent 0df7708 commit ac16baa

File tree

5 files changed

+40
-66
lines changed

5 files changed

+40
-66
lines changed

example/android/app/build.gradle

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,36 @@
1-
def localProperties = new Properties()
2-
def localPropertiesFile = rootProject.file('local.properties')
3-
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withReader('UTF-8') { reader ->
5-
localProperties.load(reader)
6-
}
7-
}
8-
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-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15-
if (flutterVersionCode == null) {
16-
flutterVersionCode = '1'
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id "dev.flutter.flutter-gradle-plugin"
176
}
187

19-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20-
if (flutterVersionName == null) {
21-
flutterVersionName = '1.0'
22-
}
23-
24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
288
android {
29-
namespace 'com.authgear.exampleapp.flutter'
30-
31-
compileSdkVersion flutter.compileSdkVersion
9+
namespace = "com.authgear.exampleapp.flutter"
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = flutter.ndkVersion
3212

3313
compileOptions {
34-
sourceCompatibility JavaVersion.VERSION_1_8
35-
targetCompatibility JavaVersion.VERSION_1_8
14+
sourceCompatibility = JavaVersion.VERSION_1_8
15+
targetCompatibility = JavaVersion.VERSION_1_8
3616
}
3717

3818
kotlinOptions {
39-
jvmTarget = '1.8'
19+
jvmTarget = JavaVersion.VERSION_1_8
4020
}
4121

4222
sourceSets {
4323
main.java.srcDirs += 'src/main/kotlin'
4424
}
4525

4626
defaultConfig {
47-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
48-
applicationId "com.authgear.exampleapp.flutter"
27+
applicationId = "com.authgear.exampleapp.flutter"
4928
// minSdkVersion flutter.minSdkVersion
5029
// 21 is required to use androidx.security
51-
minSdkVersion 21
52-
targetSdkVersion flutter.targetSdkVersion
53-
versionCode flutterVersionCode.toInteger()
54-
versionName flutterVersionName
30+
minSdk = 21
31+
targetSdk = flutter.targetSdkVersion
32+
versionCode = flutter.versionCode
33+
versionName = flutter.versionName
5534
}
5635

5736
signingConfigs {
@@ -75,6 +54,5 @@ flutter {
7554
}
7655

7756
dependencies {
78-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
7957
implementation "com.tencent.mm.opensdk:wechat-sdk-android:6.8.0"
8058
}

example/android/build.gradle

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
buildscript {
2-
// Flutter 3.24.2 requires kotlin to be 1.7.x
3-
// As of 2024-09-06, the latest kotlin 1.7.x is 1.7.21
4-
// See https://kotlinlang.org/docs/releases.html#release-details
5-
ext.kotlin_version = '1.7.21'
6-
repositories {
7-
google()
8-
mavenCentral()
9-
}
10-
11-
dependencies {
12-
classpath 'com.android.tools.build:gradle:8.8.0'
13-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14-
}
15-
}
16-
171
allprojects {
182
repositories {
193
google()
@@ -22,7 +6,6 @@ allprojects {
226
}
237

248
rootProject.buildDir = '../build'
25-
269
subprojects {
2710
project.buildDir = "${rootProject.buildDir}/${project.name}"
2811
}

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx1536M
1+
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip

example/android/settings.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +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 localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.1.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
23+
}
24+
25+
include ":app"

0 commit comments

Comments
 (0)