8000 Gradle 8.0 is not useable with Flutter 3.7. · Issue #124838 · flutter/flutter · GitHub
[go: up one dir, main page]

Skip to content
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

Closed
2 tasks done
EchoEllet opened this issue Apr 14, 2023 · 31 comments
Closed
2 tasks done

Gradle 8.0 is not useable with Flutter 3.7. #124838

EchoEllet opened this issue Apr 14, 2023 · 31 comments
8000
Labels
P2 Important issues not at the top of the work list platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version t: gradle "flutter build" and "flutter run" on Android tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@EchoEllet
Copy link
Contributor
EchoEllet commented Apr 14, 2023

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

FAILURE: Build failed with an exception.

* Where:
Script '/Users/ahmedhnewa/development/sdks/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 912

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Could not create task ':app:packLibsflutterBuildDebug'.
      > No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [/Users/ahmedhnewa/development/playground/Flutter_dump/build/app/intermediates/flutter/debug]

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'android'.
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:135)
	at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:79)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:138)
	at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)
	at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)
	at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$0(DefaultProjectStateRegistry.java:388)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:406)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:387)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:42)
	at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
	at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:35)
	at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.lambda$run$0(LifecycleProjectEvaluator.java:109)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$0(DefaultProjectStateRegistry.java:388)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$fromMutableState$1(DefaultProjectStateRegistry.java:411)
	at org.gradle.internal.work.DefaultWorkerLeaseService.withReplacedLocks(DefaultWorkerLeaseService.java:345)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:411)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:387)
	at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:100)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:72)
	at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:792)
	at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:156)
	at org.gradle.api.internal.project.ProjectLifecycleController.lambda$ensureSelfConfigured$2(ProjectLifecycleController.java:84)
	at org.gradle.internal.model.StateTransitionController.lambda$doTransition$13(StateTransitionController.java:247)
	at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258)
	at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:246)
	at org.gradle.internal.model.StateTransitionController.lambda$maybeTransitionIfNotCurrentlyTransitioning$10(StateTransitionController.java:207)
	at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34)
	at org.gradle.internal.model.StateTransitionController.maybeTransitionIfNotCurrentlyTransitioning(StateTransitionController.java:203)
	
8000
at org.gradle.api.internal.project.ProjectLifecycleController.ensureSelfConfigured(ProjectLifecycleController.java:84)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.ensureConfigured(DefaultProjectStateRegistry.java:362)
	at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:33)
	at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
	at org.gradle.configuration.DefaultProjectsPreparer.prepareProjects(DefaultProjectsPreparer.java:42)
	at org.gradle.configuration.BuildTreePreparingProjectsPreparer.prepareProjects(BuildTreePreparingProjectsPreparer.java:64)
	at org.gradle.configuration.BuildOperationFiringProjectsPreparer$ConfigureBuild.run(BuildOperationFiringProjectsPreparer.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.configuration.BuildOperationFiringProjectsPreparer.prepareProjects(BuildOperationFiringProjectsPreparer.java:40)
	at org.gradle.initialization.VintageBuildModelController.lambda$prepareProjects$2(VintageBuildModelController.java:84)
	at org.gradle.internal.model.StateTransitionController.lambda$doTransition$13(StateTransitionController.java:247)
	at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258)
	at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:246)
	at org.gradle.internal.model.StateTransitionController.lambda$transitionIfNotPreviously$11(StateTransitionController.java:221)
	at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34)
	at org.gradle.internal.model.StateTransitionController.transitionIfNotPreviously(StateTransitionController.java:217)
	at org.gradle.initialization.VintageBuildModelController.prepareProjects(VintageBuildModelController.java:84)
	at org.gradle.initialization.VintageBuildModelController.getConfiguredModel(VintageBuildModelController.java:64)
	at org.gradle.internal.build.DefaultBuildLifecycleController.lambda$withProjectsConfigured$1(DefaultBuildLifecycleController.java:116)
	at org.gradle.internal.model.StateTransitionController.lambda$notInState$4(StateTransitionController.java:154)
	at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
	at org.gradle.internal.model.StateTransitionController.notInState(StateTransitionController.java:150)
	at org.gradle.internal.build.DefaultBuildLifecycleController.withProjectsConfigured(DefaultBuildLifecycleController.java:116)
	at org.gradle.internal.build.DefaultBuildToolingModelController.locateBuilderForTarget(DefaultBuildToolingModelController.java:57)
	at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.lambda$locateBuilderForTarget$0(DefaultBuildTreeModelCreator.java:73)
	at org.gradle.internal.build.DefaultBuildLifecycleController.withToolingModels(DefaultBuildLifecycleController.java:185)
	at org.gradle.internal.build.AbstractBuildState.withToolingModels(AbstractBuildState.java:134)
	at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.locateBuilderForTarget(DefaultBuildTreeModelCreator.java:73)
	at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.locateBuilderForDefaultTarget(DefaultBuildTreeModelCreator.java:68)
	at org.gradle.tooling.internal.provider.runner.DefaultBuildController.getTarget(DefaultBuildController.java:157)
	at org.gradle.tooling.internal.provider.runner.DefaultBuildController.getModel(DefaultBuildController.java:101)
	at org.gradle.tooling.internal.consumer.connection.ParameterAwareBuildControllerAdapter.getModel(ParameterAwareBuildControllerAdapter.java:39)
	at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.getModel(UnparameterizedBuildController.java:113)
	at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.getModel(NestedActionAwareBuildControllerAdapter.java:31)
	at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.findModel(UnparameterizedBuildController.java:97)
	at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.findModel(NestedActionAwareBuildControllerAdapter.java:31)
	at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.findModel(UnparameterizedBuildController.java:81)
	at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.findModel(NestedActionAwareBuildControllerAdapter.java:31)
	at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.findModel(UnparameterizedBuildController.java:66)
	at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.findModel(NestedActionAwareBuildControllerAdapter.java:31)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:125)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:42)
	at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:64)
	at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.runAction(AbstractClientProvidedBuildActionRunner.java:131)
	at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.beforeTasks(AbstractClientProvidedBuildActionRunner.java:99)
	at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator.beforeTasks(DefaultBuildTreeModelCreator.java:52)
	at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$fromBuildModel$2(DefaultBuildTreeLifecycleController.java:74)
	at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:98)
	at org.gradle.internal.model.StateTransitionController.lambda$transition$6(StateTransitionController.java:177)
	at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258)
	at org.gradle.internal.model.StateTransitionController.lambda$transition$7(StateTransitionController.java:177)
	at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
	at org.gradle.internal.model.StateTransitionController.transition(StateTransitionController.java:177)
	at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:95)
	at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.fromBuildModel(DefaultBuildTreeLifecycleController.java:73)
	at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner.runClientAction(AbstractClientProvidedBuildActionRunner.java:43)
	at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner.run(ClientProvidedPhasedActionRunner.java:53)
	at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
	at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49)
	at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:65)
	at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:140)
	at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)
	at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40)
* Get more help at https://help.gradle.org

CONFIGURE FAILED in 1m 54s

Code sample

Code sample
I don't think it necessary to upload the source code, you can get the issue by following the steps above
however if it required I will upload it

the build.gradle (android):

buildscript {
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:8.0.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

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 image

Logs

Logs
FAILURE: Build failed with an exception.

* Where:
Script '/Users/ahmedhnewa/development/sdks/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 912

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Could not create task ':app:packLibsflutterBuildDebug'.
      > No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [/Users/ahmedhnewa/development/playground/Flutter_dump/build/app/intermediates/flutter/debug]
  • What went wrong:
    A problem occurred evaluating root project 'android'.

A problem occurred configuring project ':app'.
Could not create task ':app:packLibsflutterBuildDebug'.
> No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [/Users/ahmedhnewa/development/playground/Flutter_dump/build/app/intermediates/flutter/debug]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.7.11, on macOS 13.3 22E252 darwin-arm64, locale
    en-IQ)
    • Flutter version 3.7.11 on channel stable at
      /Users/ahmedhnewa/development/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f72efea43c (2 days ago), 2023-04-11 11:57:21 -0700
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/ahmedhnewa/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • ANDROID_SDK_ROOT = /Users/ahmedhnewa/Library/Android/sdk
    • Java binary at: /Users/ahmedhnewa/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592
      /Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/ahmedhnewa/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592
      /Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Community Edition (version 2023.1)
    • IntelliJ at /Users/ahmedhnewa/Library/Application
      Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/231.8109.175/IntelliJ IDEA
      CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.77.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.3 22E252 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 110.0.5481.177

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@yinanwang1
Copy link

MARK! I have the some problem & don't know how to fix it.

FAILURE: Build failed with an exception.

* Where:
Script '/Users/arthurwang/Public/Flutter/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 912

* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':flutter:packLibsflutterBuildDebug'.
   > No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [/Users/arthurwang/Git/Qiji/Flutter/qiji_flutter/.android/Flutter/build/intermediates/flutter/debug]

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
8000

@EchoEllet
Copy link
Contributor Author

MARK! I have the some problem & don't know how to fix it.

FAILURE: Build failed with an exception.

* Where:
Script '/Users/arthurwang/Public/Flutter/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 912

* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':flutter:packLibsflutterBuildDebug'.
   > No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [/Users/arthurwang/Git/Qiji/Flutter/qiji_flutter/.android/Flutter/build/intermediates/flutter/debug]

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

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.

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Apr 14, 2023
@darshankawar
Copy link
Member
darshankawar commented Apr 14, 2023

Thanks for the report @ahmedhnewa
I followed the steps you mentioned on an existing project by upgrading the gradle and kotlin version as specified and was able to build properly.

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

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 14, 2023
@tschiekdev
Copy link

I have the same issue. Still upgraded to android studio flamingo and upgraded android gradle to 8

@darshankawar
Copy link
Member

@atleugim
Copy link

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/build.gradle:

dependencies { classpath 'com.google.gms:google-services:4.3.15' }

@EchoEllet
Copy link
Contributor Author

Thanks for the report @ahmedhnewa
I followed the steps you mentioned on an existing project by upgrading the gradle and kotlin version as specified and was able to build properly.

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

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

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 14, 2023
@EchoEllet
Copy link
Contributor Author

image

After commenting apply for flutter.gradle from the flutter SDK, and try the sync again, the build completed just fine, this is why I called the issue name conflicting with flutter tool

@EchoEllet
Copy link
Contributor Author

https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide

The link you provide is for gradle mirgration 7 and that is quite old now since the 8 is came out

@EchoEllet

This comment was marked as off-topic.

@darshankawar
Copy link
Member

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

@darshankawar darshankawar added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. t: gradle "flutter build" and "flutter run" on Android and removed in triage Presently being triaged by the triage team labels Apr 17, 2023
@darshankawar
Copy link
Member

/cc @chunhtai

@EchoEllet
Copy link
Contributor Author

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

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,
Best regards

@agacemi
Copy link
agacemi commented Apr 17, 2023

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).

@reidbaker
Copy link
Contributor

@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.*.

@reidbaker reidbaker added the P2 Important issues not at the top of the work list label Apr 17, 2023
@reidbaker
Copy link
Contributor

Confirmed this is an issue on 3.7.11 and that 3.10 contains the fix and does not fail with gradle 8.0

@reidbaker reidbaker changed the title Gradle 8.0 conflicting with flutter android Gradle 8.0 is not useable with Flutter 3.7. Apr 17, 2023
@reidbaker
Copy link
Contributor

gradle8.0-compat.patch

These are the changes we would need to make to have gradle 8.0 work on flutter 3.7.

CaseyHillers pushed a commit that referenced this issue Apr 18, 2023
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>
@BrutalCoding
Copy link

@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'.

@EchoEllet
Copy link
Contributor Author

image

Amazing! The issue just got fixed in 3.7.12

@EchoEllet
Copy link
Contributor Author

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

@maxlapides
Copy link

@ahmedhnewa I opened a new issue for that: #125181

@EchoEll
628C
et
Copy link
Contributor Author
EchoEllet commented Apr 20, 2023

@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

@agacemi
Copy link
agacemi commented Apr 20, 2023

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

@peterweb2005
Copy link

after installed latest version 3.7.12, which has change log:
[CP] Gradle 8.0 support in flutter 3.7

but error reported, happened when trying gradle 8
Caused by: com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled.

just like:
https://stackoverflow.com/questions/74763220/a-problem-occurred-configuring-project-firebase-core

@reidbaker
Copy link
Contributor

@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'.

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

@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Apr 21, 2023
@yinanwang1
Copy link

@ahmedhnewa Except the namespace's problem, I have another problem, as follow:
org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
I have the code in the flutter's build.gradle:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Is the Flutter project is built by Java 1.8? How do you resolve this error if you had this error?
Thanks, I wish your answer.

@EchoEllet
Copy link
Contributor Author

@ahmedhnewa Except the namespace's problem, I have another problem, as follow:
org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
I have the code in the flutter's build.gradle:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Is the Flutter project is built by Java 1.8? How do you resolve this error if you had this error?
Thanks, I wish your answer.

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

@yinanwang1
Copy link

@ahmedhnewa Except the namespace's problem, I have another problem, as follow:
org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
I have the code in the flutter's build.gradle:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Is the Flutter project is built by Java 1.8? How do you resolve this error if you had this error?
Thanks, I wish your answer.

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

@EchoEllet
Copy link
Contributor Author

@ahmedhnewa Except the namespace's problem, I have another problem, as follow:
org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
I have the code in the flutter's build.gradle:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Is the Flutter project is built by Java 1.8? How do you resolve this error if you had this error?
Thanks, I wish your answer.

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

@EchoEllet
Copy link
Contributor Author

@ahmedhnewa Except the namespace's problem, I have another problem, as follow: org.gradle.api.GradleException: 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version. I have the code in the flutter's build.gradle:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Is the Flutter project is built by Java 1.8? How do you resolve this error if you had this error? Thanks, I wish your answer.

This simple gradle configurations should work for android projects:

def javaVersion = JavaVersion.VERSION_1_8
    compileOptions {
        sourceCompatibility javaVersion
        sourceCompatibility javaVersion
    }
    kotlinOptions {
        jvmTarget = javaVersion.toString()
    }

@github-actions
Copy link
github-actions bot commented May 7, 2023

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 Important issues not at the top of the work list platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version t: gradle "flutter build" and "flutter run" on Android tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

10 participants
0