I made flutter upgrade and then i started getting error like this:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':firebase_auth'.
> Could not open cp_proj generic class cache for build file '...\pub.dev\firebase_auth-4.16.0\android\build.gradle' (...\.gradle\caches\7.5\scripts\cgn5tflzeqkj3igmg2atxpir).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':firebase_auth' of type org.gradle.api.Project.
> Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> Could not get unknown property 'android' for project ':firebase_auth' of type org.gradle.api.Project.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project's Gradle version is incompatible with the Java version that Flutter is using │
│ for Gradle. │
│ │
│ If you recently upgraded Android Studio, consult the migration guide at │
│ https://flutter.dev/to/to/java-gradle-incompatibility. │
│ │
│ Otherwise, to fix this issue, first, check the Java version used by Flutter by running `flutter │
│ doctor --verbose`. │
│ │
│ Then, update the Gradle version specified in │
│ ...\android\gradle\wrapper\gradle-wrapper.properties to │
│ be compatible with that Java version. See the link below for more information on compatible │
│ Java/Gradle versions: │
│ https://docs.gradle.org/current/userguide/compatibility.html#java │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1
When i run flutter doctor -v i getting these:
[√] Flutter (Channel stable, 3.24.4, on Microsoft Windows [Version 10.0.22631.4317], locale tr-TR)
• Flutter version 3.24.4 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 603104015d (2 days ago), 2024-10-24 08:01:25 -0700
• Engine revision db49896cf2
• Dart version 3.5.4
• DevTools version 2.37.3
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\shnyk\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Users\shnyk\AppData\Local\Programs\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.11.35208.52
• Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2024.2)
• Android Studio at ...\AppData\Local\Programs\Android Studio
• 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 21.0.3+-12282718-b509.11)
[√] VS Code (version 1.93.1)
• VS Code at ...\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.96.0
[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 15 (API 35) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4317]
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.70
• Edge (web) • edge • web-javascript • Microsoft Edge 130.0.2849.46
[√] Network resources
• All expected network resources are available.
I guess this releated with Java version. I uninstall Java 21 and then install. I added JAVA_HOME in enviroments. But flutter doctor -v didn’t updated and already shows java 21. I think if i can change this my problem will solved but i can’t do.
When i entered this block to android/gradle.properties it works. I can compiled and ran successfully but this is not best way i know. org.gradle.java.home=C:/Program Files/Java/jdk-11.x.x
Can someone help me about that?
You need to sign in to view this answers
Leave feedback about this