Android Local Run Build Error: AGP and Java Compatibility Issue

Project Settings

When trying to run a local Android build via FlutterFlow, I encounter the following error:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Upgrading build.gradle
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':webview_flutter_android:compileDebugJavaWithJavac'.
    Could not resolve all files for configuration ':webview_flutter_android:androidJdkImage'.
    Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
    Execution failed for JdkImageTransform: ...\core-for-system-modules.jar.
    Error while executing process ...\jlink.exe with arguments {--module-path ... --add-modules java.base --output ... --disable-plugin system-modules}

[!] This is likely due to a known bug in Android Gradle Plugin (AGP) versions less than 8.2.1, when

  1. setting a value for SourceCompatibility and

  2. using Java 21 or above.
    To fix this error, please upgrade your AGP version to at least 8.2.1.

What have you tried so far?
  • I manually updated the line id "com.android.application" version "8.1.0" apply false in the settings.gradle file to 8.2.1.

  • With this manual change, I can successfully build the project locally, but when I use the "Run Device" feature in the FlutterFlow UI, the AGP version reverts or the error persists.

  • My Android Studio, Java, and SDK installations are up to date, and my Flutter doctor output is clean.

  • I have searched for similar issues in the FlutterFlow community and on Stack Overflow, and tried all suggested manual updates, but the FlutterFlow build process still reverts the AGP version or fails with the same error.

Did you check FlutterFlow's Documentation for this topic?
No
3
5 replies