Skip to content

Conversation

ChristianKleineidam
Copy link
Contributor

This PR upgrades the Android build settings for packages/noise_meterfrom Java 8 to Java 21 so the plugin compiles cleanly on modern Flutter toolchains that ship with Android Gradle Plugin (AGP) 8 and Kotlin 2.

Key changes

In packages/noise_meter/android/build.gradle

compileOptions now sets sourceCompatibility and targetCompatibility to JavaVersion.VERSION_21.

Every KotlinCompile task now has kotlinOptions.jvmTarget = "21".

All lines that hard‑coded VERSION_1_8 or jvmTarget = "1.8" have been removed.

pubspec.yaml has its patch version bumped from 4.2.0 to 4.2.1 and notes the Java 21 migration in the description.

CHANGELOG.md records the upgrade and the build error it resolves.

Why this matters

Current releases of Flutter, Android Studio, AGP 8+ and Kotlin 2 default to Java 17 or higher. When the library’s Gradle script forces Java 8 while Kotlin or other modules emit Java 17/21 byte‑code, builds fail with
Execution failed for task ':noise_meter:compileDebugKotlin' — Inconsistent JVM‑target compatibility (1.8 vs 17/21).
Raising both Java and Kotlin targets to 21 removes that conflict, allowing apps to compile without per‑project work‑arounds.

Compatibility

No runtime behaviour changes—the produced APK/DEX remains compatible with the plugin’s existing minSdkVersion.

Building now requires JDK 21 or newer, which is the default JDK bundled with Android Studio 2025.1 and fully supported by AGP 8.4+.

Please review and merge so the community can build noise_meter seamlessly on current Flutter and Android Studio versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant