FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
123 stars 19 forks source link

Your project's Gradle version is incompatible with the Java version that Flutter is using for Gradle #4011

Open vladarino opened 1 week ago

vladarino commented 1 week ago

Can we access your project?

Current Behavior

Problem is well defined here: https://community.flutterflow.io/ask-the-community/post/gradle-incompatible-version-8rzRlDhxQ09Ozfx

I have a test project involves audio input that I want to test on my Pixel 6 Pro device. The test project works well in Test Mode but Test Mode doesn't support audio input so I must now test in Local Run mode. I'm able to see my Pixel in Local Run Status as "Ready". When I click "Test" I eventually get the error message stating that my project's Gradle version isn't compatible with Flutter's Java version. I looked online for help and tried to sync up the Gradle version but nothing worked. I'm stuck now.

(FYI, I recently installed the latest FlutterFlow desktop and Android Studio.)

Expected Behavior

I expect that my code will be loaded on my Android device for testing.

Steps to Reproduce

  1. Install FlutterFlow Mac desktop as of 10/8/2024 (version 5.0.3)
  2. Install Android Studio Ladybug | 2024.2.1 (Mac)
  3. Make sure Mac Android development environment is set up per FlutterFlow documentation instructions
  4. Create app that has user authentication tied to Firebase and accepts user audio input for upload with the click of a button
  5. Connect Android phone via USB to your Mac
  6. In FlutterFlow Mac desktop, select your Android device and click "Test" in Local Run screen
  7. Get the Gradle version error

Reproducible from Blank

Bug Report Code (Required)

IT4szuflw5dOm9xE17qBc+5r/T8UC2k2aLgwscp/bxIgGIDzPOw+ZPWlZRBtTu2mT0FPPkSmmTkC0PDXkuPfUu4oJQ+VY7Zl/6hycTzgUmCjUZOBEpG0XURSHeNWCWqv5qW7owlvCNpZLmRl12bzOu+ASj3bJrX7IndISq/LZO4=

Visual documentation

device-log-error-android flutter-doctor

Environment

- FlutterFlow version: 3.24.3
- Platform: Web; iMac OS Sonoma 14.6.1 - 3.7 GHz 6-Core Intel Core i5
- Browser name and version: Version 1.70.123 Chromium: 129.0.6668.89 (Official Build) (x86_64)
- Operating system and version affected: iMac OS Sonoma 14.6.1 - 3.7 GHz 6-Core Intel Core i5

Additional Information

I am trying to test the core functionality of a music app but am not able to do so because I can't load my app to my mobile device. The Test Mode does not support audio, and besides, I need to test on a real device to confirm that the audio upload and playback works. I'm stuck and can't move forward with app development.

Alezanello commented 1 week ago

Hi there!

I took a quick look at the logs and noticed that you're using Flutter v3.24.3, while FlutterFlow is currently on v3.22.2. Could you try downgrading to the earlier version and testing again?

Let me know if you need any help with this!

vladarino commented 1 week ago

@Alezanello Thanks for your response. Do I downgrade Flutter to v3.22.2 as well? Also, what's the best way to downgrade Flutter (I'm worried I might break something doing so)? Are there instructions somewhere? You help is greatly appreciated.

vladarino commented 1 week ago

@Alezanello Ok, I was able to downgrade with the help of Gemini chat bot. I still get the same error after restarting my FlutterFlow desktop and retrying the local run to my android device. Relevant screenshots attached.

I also opened Android Studio to see if I could find any clues. I did notice it complaining about my Gradle 7.5 version and asking me to upgrade to a newer version.

devicelog-2024-10-09-v1 flutter-dr-2024-10-09-v1 android-studio-gradle-error-v1
vladarino commented 1 week ago

@Alezanello FYI, I was table to test my app using the iOS simulator. My audio input aspects of my app worked fine. The Android simulator testing failed for the same Gradle issue I describe above.

neiljaywarner commented 1 week ago

@SameerShahzad99 @Alezanello this is very important, i'm experiencing this issue too with not much. more than file new project with firebase auth, it's pretty much a show stopper. i am trying homebrew openjdk and stackoverflow etc but it is verry concerning in an otherwise awesome product

ali90903 commented 1 week ago

I have the same issue here for 3 days

rahil320 commented 1 week ago

I was having a similar issue when I installed the latest desktop version of Flutterflow (downloaded on 13th October '24) on newly installed Windows PC along with latest Android studio. Here is how I solved the problem of XML and Gradle build. It seems that latest FF uses gradle version 7.5 which is compatible with Java version 18. If you install latest Android studio then it comes with a different version of Java ( version 21 or greater). The solution was to "downgrade" Android studio to something which is compatible with FF requirements. I used android-studio-2024.1.1.11-windows and it works perfectly well. Local build is now compiling and running FF projects on Android Emulator

vladarino commented 1 week ago

@rahil320 Thank you my friend, that worked! I was able to test my app on the Android emulator and a physical Pixel device.

For those on a Mac this is what I did:

  1. Downloaded Android Studio 2024.1.1.11 (Koala | 2024.1.1 June 13, 2024)
  2. Put my Android Studio.app file in the thrash
  3. Copied the new Android Studio.app file in my Applications folder
  4. Started Android Studio and clicked "Yes" to the dialog about HTTP Proxy Server
  5. Used Android Studio to open my project that FlutterFlow installed on my machine after I initiated the Local Run (/Users//Library/Application Support/io.flutterflow.prod.mac/
  6. Clicked Device Manager icon on the right menu and selected a Pixel device for the emulator
  7. Clicked the Play button to run my code on the emulator. I had issues hearing sound, but that's a whole other problem.

Since sound was problematic on the emulator, I tried on my physical Pixel device. The audio recording and playback worked, though there were some weird Exceptions thrown in the Android Studio console related to the AudioPlayer widget. It worked though.

@Alezanello It would be great if the FlutterFlow team could at least test the production version of FlutterFlow with the latest production Android Studio so that your team can update the documentation with any tips or warnings regarding compatibility with latest Android Studio. Provide advice on which version of Android studio is confirmed to work with what versions of FlutterFlow. That would have solved this whole problem.

Android Studio download archives: https://developer.android.com/studio/archive

image

dixonl90 commented 6 days ago

After downloading Mac (Apple Silicon): android-studio-2024.1.1.11-mac_arm.dmg, I still can't build. Flutter doctor reports Java v17. The flutterflow generated gradle-wrapper file uses gradle-7.5, which according to https://docs.gradle.org/current/userguide/compatibility.html#java isn't supported. I need to find an Android Studio release with Java 18. :(

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/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.10+0-17.0.10b1087.21-11609105)
rahil320 commented 4 days ago

@vladarino Hi, i'm facing exactly the same issue, i tried to follow your steps but i can't access to Library folder from the Open button on Android Studio, Library doesn't appear on the liste, did you get the same issue ?

This folder is hidden on MAC. Search on Google how to show this folder and you'll be able to access it.