-
-
Notifications
You must be signed in to change notification settings - Fork 963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to fix Android Compilation issues #3303
Comments
miquelbeltran
added
all
android
compile
Compilation error
and removed
question
Further information is requested
labels
Oct 5, 2024
miquelbeltran
changed the title
Android Compilation issues
How to fix Android Compilation issues
Oct 5, 2024
This ticket is locked to avoid discussion in here. If you have done everything in this guide and still face compilation issues, create a ticket using the Compile template: https:/fluttercommunity/plus_plugins/issues/new?assignees=&labels=compile%2Ctriage&projects=&template=COMPILATION.yaml&title=%5BCompile%5D%3A+ and include all your gradle files and the gradlew version number. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This ticket contains some tips to help mitigate recent Android compilation issues.
Before attempting any solution, ensure that your project has been migrated to the new Android project structure:
You can also find a reference to the different Android Gradle Plugin (AGP) and Gradle versions here:
There is also a main ticket on flutter/flutter discussing this issue:
source value 8 is obsolete
/target value 8 is obsolete
flutter/flutter#156111What causes the issue
The majority of issues come from using the latest Android Studio (Ladybug 2024.2.1), which ships the Java SDK 21.
e.g. running
flutter doctor -v
:The simplest solution is to downgrade Android Studio and use Java 17, now, let's attempt to fix this with the latest Android Studio version.
Compilation issues
The first compilation issue you will see with a newly created project with Flutter
3.24.3
and addingconnectivity_plus
(or any other Android plugin) is:Checking project dependencies
The project comes with the following AGP:
And the following gradle wrapper:
Checking plugin requirements
The plugins README lists the following version requirements:
Upgrading dependencies
To apply these, change the following:
Open
android/app/build.gradle
and change:Open
android/gradle/wrapper/gradle-wrapper.properties
and change:Open
android/settings.gradle
and change:All these follow the minimum version requirements as specified by the plugin README file.
Now the project compiles again:
NDK Error
You may see the following error on screen:
Seems that you can ignore this error, as the project still compiles.
Changing the Java SDK
You can try to set the Jdk path using the
flutter config --jdk-dir
command. I haven't tried that but it's something you can consider if everything else fails.flutter config --jdk-dir
to configure it.flutter doctor -v
The text was updated successfully, but these errors were encountered: