Select to view content in your preferred language

Solution: Android Studio Ladybug 2024.2.1+ and Flutter compatibility issue relating to Java version.

1247
0
12-12-2024 02:28 AM
Labels (1)
JenMerritt
Esri Contributor
3 0 1,247

If you are using the latest release of Android Studio - Ladybug 2024.2.1+ - you may encounter an error when attempting to launch a Flutter app. For example, when attempting to run the sample viewer application for ArcGIS Maps SDK for Flutter samples, you may encounter an error such as:

"Unknown Kotlin JVM target: 21"

Likewise when creating a new Flutter project using the flutter create command, you may encounter the following warning:

"The configured version of Java detected may conflict with the Gradle version in your new Flutter app."

This problem relates to the version of Java that has been bundled with Ladybug (JDK 21) not being backwards compatible with Flutter's requirements (JDK 17) and the version of Gradle being used by Flutter.

A solution to both creating a new Flutter app and running our sample viewer application with Android Studio Ladybug is to manually install JDK 17 and redirect Flutter to use it.

You can either do this from Android Studio by going to:

Settings -> Build Tools -> Gradle JDK Location, and setting the path to your JDK 17 installation.

Or, from the command line, by running:

flutter config --jdk-dir=<your-local-JDK-17-path>

We hope this helps with any Flutter developers running into this issue. We also hope to see this resolved in a future version of Flutter.