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

Need the ability to configure Java version when building Android app on per-project basis #7815

Open
miklcct opened this issue Nov 25, 2024 · 2 comments

Comments

@miklcct
Copy link

miklcct commented Nov 25, 2024

Thanks for the feedback! If your issue is related to the Flutter framework itself,
please open an issue at
github.com/flutter/flutter.

Steps to Reproduce

  1. Install IntelliJ IDEA, Android and Flutter plugins.
  2. Download a few versions of Java JDK in IntelliJ IDEA, and add one of them into the PATH.
  3. Install Android SDK using IntellliJ IDEA.
  4. Build a Flutter app using a Gradle version which is compatible to one of the JDKs installed, but not the one in the PATH.

The Android app will fail to build because the Java version is not compatible. As different Flutter apps can use different Gradle versions, I need to configure the JDK version on the Android app on a per-project basis.

Related: flutter/flutter#159411

Version info

'''
[√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [Version 10.0.22621.4460], locale en-GB)
• Flutter version 3.24.5 on channel stable at C:\Users\Michael\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision dec2ee5c1f (12 days ago), 2024-11-13 11:13:06 -0800
• Engine revision a18df97ca5
• 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\Michael\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Users\Michael.jdks\openjdk-23.0.1\bin\java.exe
• Java version OpenJDK Runtime Environment (build 23.0.1+11-39)
• 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 Build Tools 2022 17.12.1)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.12.35514.174
• Windows 10 SDK version 10.0.22621.0

[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/to/windows-android-setup for detailed instructions).

[√] IntelliJ IDEA Ultimate Edition (version 2024.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2024.3
• Flutter plugin version 82.2.4
• Dart plugin version 243.22562.3

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.4460]
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.86
• Edge (web) • edge • web-javascript • Microsoft Edge 131.0.2903.63

[√] Network resources
• All expected network resources are available.

! Doctor found issues in 1 category.
'''

@drlopera
Copy link

drlopera commented Nov 28, 2024

similar issue migrating a flutter flow application through GitHub repository. The repository is cloned without any problems. Installations worked also without any problem. But when I try to run the application, that works in flutter flow, the problem starts with the Griddle, java, and other incompatibility problems. I used AndriodStudio LadyBug's last version.

@miklcct
Copy link
Author

miklcct commented Nov 29, 2024

similar issue migrating a flutter flow application through GitHub repository. The repository is cloned without any problems. Installations worked also without any problem. But when I try to run the application, that works in flutter flow, the problem starts with the Griddle, java, and other incompatibility problems. I used AndriodStudio LadyBug's last version.

Unfortunately I can no longer work on a project using a computer with the latest version of Android Studio (which comes with Java 21) installed.

I couldn't upgrade Gradle to 8.11.1 because there are some incompatibility issues with my dependencies, and Gradle 7.6.1 (the latest version supported by Flutter documentation) is incompatible with Java 21 bundled with Android Studio.

Even when I set JAVA_HOME to Java 17, Flutter still picks up the Java 21 in Android Studio, making it impossible to develop that project on a machine with Android Studio installed. (If I use a machine without Android Studio but with an IntelliJ IDEA Ultimate with Android plugin, it works by setting the default Java version to 17)

Please escalate this issue as it means that the official documentation no longer works with the official build tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants