Skip to content

Flutter forces JAVA_HOME to android studio's default JDK #108804 #110807

@arteminthesky

Description

@arteminthesky

Duplicate of #108804

Hi. On my Jenkins i found the problem with jdk. The problem is Flutter forces JAVA_HOME as founded default JDK in Android Studio.app (Determine JDK, Force JAVA_HOME)
I think this is not expected behavior when i don't want to use Studio's settings.

Is there a way to not rewrite JAVA_HOME in case it's already set?

Steps to Reproduce

  1. Run flutter build apk command
  2. See log output
  3. See <JDK> -version command

Actual result:
Flutter used default JDK from Android Studio
Gradle throws error since default JDK contains Java 1.8 (Java 11 is required)

Expected result:
Flutter uses JAVA_HOME (in case it's defined)

Logs

[✓] Flutter (Channel unknown, 3.0.0, on Mac OS X 10.15.4 19E287 darwin-x64, locale en-GB)
    • Flutter version 3.0.0 at ***
    • Upstream repository unknown
    • Framework revision ee4e09cce0 (3 months ago), 2022-05-09 16:45:18 -0700
    • Engine revision d1b9a6938a
    • Dart version 2.17.0
    • DevTools version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Applications/Android/sdk/
    • Platform android-32, build-tools 30.0.3
    • ANDROID_HOME = /Applications/Android/sdk/
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[!] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Applications/Xcode-12.4.app/Contents/Developer
    ✗ Flutter requires Xcode 13 or higher.
      Download the latest version or update via the Mac App Store.
    ! CocoaPods 1.10.1 out of date (1.11.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 3.2)
    • 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 1.8.0_152-release-1136-b06)

[✓] Connected device (1 available)
    • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E287 darwin-x64

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

! Doctor found issues in 3 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: duplicateIssue is closed as a duplicate of an existing issuet: gradle"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions