Skip to content

Commit eb61765

Browse files
authored
Merge pull request #433 from DanXi-Dev/upgrade-gradle
Upgrade Gradle version
2 parents 6eeddea + d753634 commit eb61765

7 files changed

+28
-12
lines changed

android/app/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ gradle.taskGraph.whenReady {
3939
android {
4040
compileSdkVersion 34
4141

42-
ndkVersion "26.2.11394342"
42+
ndkVersion "28.0.12433566"
4343

4444
sourceSets {
4545
main.java.srcDirs += 'src/main/kotlin'
@@ -81,6 +81,5 @@ flutter {
8181
}
8282

8383
dependencies {
84-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0"
8584
implementation 'com.google.android.material:material:1.12.0'
8685
}

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="io.github.w568w.dan_xi">
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

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools"
3-
package="io.github.w568w.dan_xi">
2+
xmlns:tools="http://schemas.android.com/tools">
43

54
<!-- Access to the Internet -->
65
<uses-permission android:name="android.permission.INTERNET" />
@@ -38,7 +37,7 @@
3837
android:fullBackupContent="@xml/backup_rules"
3938
android:dataExtractionRules="@xml/data_extraction_rules">
4039
<activity
41-
android:name=".MainActivity"
40+
android:name="io.github.w568w.dan_xi.MainActivity"
4241
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
4342
android:exported="true"
4443
android:hardwareAccelerated="true"

android/build.gradle

+20-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,30 @@ allprojects {
77

88
rootProject.buildDir = '../build'
99

10+
1011
subprojects {
1112
afterEvaluate { project ->
13+
// override the android compileSdkVersion and namespace for each dependencies to compile with the latest Gradle
1214
if (project.plugins.hasPlugin("com.android.application") ||
1315
project.plugins.hasPlugin("com.android.library")) {
14-
project.android {
15-
compileSdkVersion 34
16+
project.android.compileSdkVersion = 34
17+
if (project.android.namespace == null) {
18+
def manifest = new XmlSlurper().parse(file(project.android.sourceSets.main.manifest.srcFile))
19+
def packageName = manifest.@package.text()
20+
println("Setting ${packageName} as android namespace")
21+
project.android.namespace = packageName
22+
}
23+
// override the kotlin language version for each dependencies to 2.0.20
24+
if (project.buildscript.configurations.hasProperty("classpath")) {
25+
def found = false
26+
project.buildscript.configurations.classpath.getDependencies().each { dep ->
27+
if (dep.group == "org.jetbrains.kotlin" && dep.name == "kotlin-gradle-plugin") {
28+
found = true
29+
}
30+
}
31+
if (found) {
32+
project.buildscript.dependencies.add("classpath", "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20")
33+
}
1634
}
1735
}
1836
}

android/gradle.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ android.enableJetifier=true
33
org.gradle.jvmargs=-Xmx4096M -XX:MaxNewSize=3G
44
org.gradle.parallel=true
55
org.gradle.caching=true
6-
org.gradle.configureondemand=false
6+
org.gradle.configureondemand=false
7+
kotlin.jvm.target.validation.mode=warning

android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-all.zip

android/settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "7.1.3" apply false
21+
id "com.android.application" version "8.7.0" apply false
2222
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
2323
}
2424

0 commit comments

Comments
 (0)