Flutter is a rapidly evolving framework with a rich package environment on pub.dev. Since the release of our SDK in November, there have been several updates to various dependencies of the Flutter Maps SDK. If you continue to use the minimum versions as advertised in our system requirements, everything should continue to work without modification. However, as you begin to update your version of Flutter, Android Studio, and other dependencies, there are various modifications you may need to make to get your builds up and running.
If you are using the latest release of Android Studio - Meerkat 2024.3.1+, you may encounter some challenges with managing dependencies of our Flutter Maps SDK when using arcgis_maps 200.6 package on pub.dev.
Current Working Environment
Below is the current setup:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.1 24D70 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.98.1)
Setting Up JDK 17
The Flutter Maps SDK v200.6 is based on Flutter 3.24, which works on JDK 17. However, Android Studio Ladybug and later versions use Android 34 or later, which are based on JDK 21. This discrepancy can lead to issues, as highlighted in the GitHub issue regarding Android plugins: Failed to transform core-for-system-modules.jar to match attributes errors with JDK 21
To resolve this, you need to set up JDK 17 as your default JDK for Flutter.
On macOS:
To install JDK 17 on macOS using Homebrew, follow these steps:
brew install openjdk@17
sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
flutter config --jdk-dir=/opt/homebrew/Cellar/openjdk@17/17.0.14/libexec/openjdk.jdk/Contents/Home
On Windows:
Download OpenJDK 17 from Microsoft's OpenJDK page. After extracting the JDK zip to your desired folder, configure it using PowerShell:
flutter config --jdk-dir PATH-TO-JDK
Android NDK Warning
When you run your ArcGIS Maps SDK for Flutter App for the first time, you might encounter the following warning:
Your project is configured with Android NDK 25.2.9519653, but the following plugin(s) depend on a different Android NDK version:
- device_info_plus requires Android NDK 27.0.12077973
- flutter_web_auth_2 requires Android NDK 27.0.12077973
- haptic_feedback requires Android NDK 27.0.12077973
- location requires Android NDK 27.0.12077973
Our SDK minimum is Flutter 3.24, which uses NDK 25. However, if you upgrade your app build to use the latest Flutter, this will require NDK 27.
Fix:
Update your Android NDK setup in android/app/build.gradle.kts:
ndkVersion = "27.0.12077973"
Flutter Web Auth 2 Error
You might encounter a build exception:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_web_auth_2:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
This is because arcgis_maps 200.6 package is based on flutter_web_auth_2: ^3.1.2, which breaks when working with the latest Flutter. Hence, you need to set it to the latest version of flutter_web_auth_2 from pub.dev.
Fix:
Add the following dependency override to pubspec.yaml:
dependency_overrides:
flutter_web_auth_2: ^4.1.0 # Or a newer version available on pub.dev
We hope this helps any Flutter developers encountering these issues. We also hope to see these resolved in a future version of Flutter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.