Skip to content

Gradle: Use Java bundled with Android Studio #8515

Closed

Description

@goderbauer

The Gradle-based build process currently requires either JAVA_HOME to be set or that java is in your path. It would be nice if Gradle could just use the Java version that comes bundled with Android Studio (C:\Program Files\Android\Android Studio\jre).

Especially on platforms that don't ship with java by default (e.g. Windows), that would simplify the setup instructions to get started (e.i. remove the need to download and install stand-alone Java).

/cc @jakobr-google @mit-mit

Activity

  1. sethladd commented on Mar 2, 2017

    @sethladd
    Contributor
  2. goderbauer commented on Mar 2, 2017

    @goderbauer
    MemberAuthor

    Currently, people on Windows need to do one of the following:

    • Download and install the ~200MB Java run-time from Oracle after accepting Oracle's License Agreement, or
    • Add the Java version bundled with Android Studio to their PATH (a multi-step process on Windows).

    If Flutter were smart enough to just use the bundled Java version, we could skip those steps. With less setup steps, there are fewer chances for miss-configuration, and people can get started quicker with writing apps!

  3. added
    t: gradle"flutter build" and "flutter run" on Android
    on Mar 2, 2017
  4. jakobr-google commented on Mar 2, 2017

    @jakobr-google
    Contributor

    That would be super nice, yeah. It's actually the version of Gradle that's bundled with Android Studio that requires Java (and apparently doesn't think to look in the jre directory right next to itself...).

    We could get Flutter Tools to detect this situation and set JAVA_HOME when calling Gradle.

  5. goderbauer commented on Mar 2, 2017

    @goderbauer
    MemberAuthor

    I just verified this under Windows: when I uninstall stand-alone Java and manually set my JAVA_HOME to the bundled JRE directory, flutter works still as expected.

  6. mit-mit commented on Mar 3, 2017

    @mit-mit
    Member

    Sounds really nice if we could get rid of that extra install!

  7. added this to the milestone on Mar 3, 2017
  8. Monster-Gaming-Studios commented on Aug 15, 2020

    @Monster-Gaming-Studios

    Hello,
    Is it hard-coded in flutter to use Java bundled with Android Studio or can I change it to my JDK installation? I have my JAVA_HOME correctly setup and when I run java -version, it reports the version from my JDK installation, but flutter always uses the Java bundled with Android Studio even though it is not in my PATH and even when running from Powershell or Visual Studio Code. Is there anyway that I can tell flutter to use the JDK version of Java?

    Thanks.

  9. github-actions commented on Aug 17, 2021

    @github-actions

    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.

  10. locked as resolved and limited conversation to collaborators on Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t: gradle"flutter build" and "flutter run" on Android

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions