-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Gradle 8.0 is not useable with Flutter 3.7. #124838
Comments
MARK! I have the some problem & don't know how to fix it.
|
Let's hope the flutter team or individual developer can do somthing about, it's probably issue between flutter and android because I tried upgrade old project gradle to 8.0 and it work just fine, and I also tried create new project and I never have any issues, we can make a workaround this issue but it will not work efficiently and it need apply changes to flutter tool gradle global configurations for all projects which is not a convient and doesn't make much sense since after upgrade, all changes will be reverted and it might create even more issues, so I hope flutter team can do something about that and I'm sure they can do it very easily. |
Thanks for the report @ahmedhnewa I see that you mentioned in point # 3 that the AS version should be the latest (Flamingo). I am not on it yet. So want to confirm if this error is occuring only on the latest AS version only or on lesser version as well ? Maybe related ? #112858 |
I have the same issue. Still upgraded to android studio flamingo and upgraded android gradle to 8 |
Also see if this helps https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide referenced from https://twitter.com/FlutterDev/status/1646587493934833664?s=20 |
Also when you update the version of gradle (as mentioned here) and you use google-services in the dependencies you need to update the dependency in
|
Android studio flamingo just got released and gradle 8.0 is new, even if you got the build successful, one of the steps required when upgrade gradle to 8.0 is to move the package name from AndroidManifests.xml to somewhere else, please upgrade gradle using the assistant tool in android studio and not by hand in code, when you run the app you should get an error since flutter need the package name to be in AndroidManifests.xml |
The link you provide is for gradle mirgration 7 and that is quite old now since the 8 is came out |
This comment was marked as off-topic.
This comment was marked as off-topic.
Thanks for the update. I am unable to replicate the reported error. Maybe since I am not on Flamingo version yet. Also, keeping this link here for reference: https://developer.android.com/studio/known-issues |
/cc @chunhtai |
Can you please clarify what exactly you did in details? There has to be something wrong since the other coders verify the issue Thank you for your time, |
I think that this issue was resolved by the fellowing PR #121958. Somes deprecated fileds were removed from API since Gradle 8.x (may be since Gradle 7.6 https://docs.gradle.org/current/userguide/upgrading_version_7.html#changes_8.0). |
@ahmedhnewa I believe this is fixed in the beta channel. Documentation for switching channels can be found here. https://docs.flutter.dev/release/upgrade#switching-flutter-channels. Meanwhile if you wish to stay on 3.7 you can update to gradle 7.6.*. |
Confirmed this is an issue on 3.7.11 and that 3.10 contains the fix and does not fail with gradle 8.0 |
These are the changes we would need to make to have gradle 8.0 work on flutter 3.7. |
Pull the minimal set of changes from flutter 3.10 (in beta) into flutter 3.7 to support gradle 8.0 [124838](#124838) [Original PR](#121958) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. --------- Co-authored-by: André Sousa <andrelvsousa@gmail.com>
@reidbaker If not mistaken, this issue has been resolved in the stable branch right? According to https://github.com/flutter/flutter/releases/tag/3.7.12 it seems to be out in stable with the hotfix. I upgraded to 3.7.12 today with 'flutter upgrade'. |
However pub.dev plugins don't work, gradle 8.0 requires defining namespace in android gradle and all plugins right now don't support that |
@ahmedhnewa I opened a new issue for that: #125181 |
There is a possibility that this issue can't be fixed since this isuse to the plugin itself. The plugin authors need to update their build.gradle app module and add the namespace, however I think they will figure somthing out |
namespace in module is a breaking change introduced by AGP since 7.3 https://developer.android.com/build/releases/gradle-plugin#namespace-dsl .. I wonder if there is a workaround especially for older native library |
after installed latest version 3.7.12, which has change log: but error reported, happened when trying gradle 8 just like: |
Yes I think I landed the code required to use gradle 8 in 3.7.12 It is possible I missed something if that is the case let me know |
@ahmedhnewa Except the namespace's problem, I have another problem, as follow:
Is the Flutter project is built by Java 1.8? How do you resolve this error if you had this error? |
The new bundled jdk in the latest version of Android studio is 17 so all new projects should target that version, but I think flutter internally still using jdk 8 so even if you tagret jdk 17 you probably have compatibility issues, it's matter of time until this issues fixed Try target jdk 17 and see if that works but I don't think you will not have compatibility issues Good luck |
Thx |
Oh, I forgot to mention that in native Android development, kotlin compose compiler still target java 8, so you might want target java 8 even if the bundled jdk is 17 and try to not use external java jdk for android development and gradle build for android, if you still have issues, please send me your gradle configurations and I will see what I can do, you might want contact me privately if you want |
This simple gradle configurations should work for android projects:
|
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Is there an existing issue for this?
Steps to reproduce
1- create a new flutter project
2- open the android folder as android project in android studio
3- make sure you have the latest version of Android Studio (Flamingo) which released yesterday
4- go to build.gradle and update kotlin_version to '1.8.20' and click sync now
5- APG upgrade assistant will prompt you to upgrade gradle which is the build system for android projects, to upgrade it to 8.0 which is the latest stable, and if it doesn't, go to tools and click on it, and run it and click run the selected steps, and after it finish you will have some errors, even if you don't, the new build system require to move the package name value from android manifests to somewhere else, so when you try to run the application, flutter need the package name in the android manifest in order to work as I remember, but for now let's fix the first issue which is build failed, it conflict which the way that flutter work in the android project
Expected results
We all should be able to use the latest build system, gradle 8.0 without any errors, sooner or later it will be required, please notice I didn't provide the full result or the full log error of gradle sync task since it's more than 65536 characters which is the maximum in github, thank you for your time.
Actual results
console error log
Code sample
Code sample
buildscript {
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Screenshots or Video
Screenshots / Video demonstration
Logs
Logs
A problem occurred evaluating root project 'android'.
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: