Skip to content

Commit 1792345

Browse files
committed
Silence obsolete-Java-8-target and native-access build warnings
Two of the three warnings from the last debug build are safe to fix now: - compileOptions/kotlinOptions targeted Java 8 bytecode, which javac on JDK 20+ warns is obsolete and will eventually be removed. Bump source/target/jvmTarget to Java 17, matching AGP 9's own JDK 17 minimum. - Gradle's native-platform library trips JDK 24+'s restricted native access warning on every build. Pass --enable-native-access=ALL-UNNAMED via org.gradle.jvmargs to acknowledge it, same as Gradle's own recommended workaround until Gradle ships a module descriptor for it. The third warning - "applies the Kotlin Gradle Plugin, which will cause build failures in future versions of Flutter" - is left alone. It's telling us to migrate to AGP 9's built-in Kotlin support, which gradle.properties already deliberately opts out of: the Flutter Gradle Plugin still throws an NPE under that mode (flutter/flutter#191703, confirmed still open). Migrating now would trade a future warning for a build that breaks today. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014gbNnPCT7nUxeWAQDiTzGR
1 parent b7c2fce commit 1792345

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎android/app/build.gradle‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ android {
1818
ndkVersion = flutter.ndkVersion
1919

2020
compileOptions {
21-
sourceCompatibility = JavaVersion.VERSION_1_8
22-
targetCompatibility = JavaVersion.VERSION_1_8
21+
sourceCompatibility = JavaVersion.VERSION_17
22+
targetCompatibility = JavaVersion.VERSION_17
2323
}
2424

2525
kotlinOptions {
26-
jvmTarget = JavaVersion.VERSION_1_8
26+
jvmTarget = JavaVersion.VERSION_17
2727
}
2828

2929
defaultConfig {

‎android/gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
1+
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError --enable-native-access=ALL-UNNAMED
22
android.useAndroidX=true
33
android.enableJetifier=true
44

0 commit comments

Comments
 (0)