Borsaa
Borsaa

Reputation: 1

Flutter build JAVA_HOME directory path is different from the one I set in the System Environment Variables

I set a new JAVA_HOME path in the System Environment Variables, since the old one was too outdated. However when I run flutter run in the terminal, it logs this message:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jre1.8.0_431

Please set the JAVA_HOME variable in your environment to match the location of your Java installation. Running Gradle task 'assembleDebug'... 54ms Error: Gradle task assembleDebug failed with exit code 1

The current JAVA_HOME path is "C:\Program Files\Java\jdk-11.0.2" (which also shows when I run java -version command in cmd).

How do I change the path Android Studio stil points to?

I tried:

  1. Uninstalled ALL Java versions
  2. Downloaded the needed JDK
  3. Set the correct JAVA_HOME path in the System Environment Variables
  4. Rebooted the system
  5. Ran commands in cmd to check if the version is correct (it is)

What went wrong When trying to run my current Flutter project, terminal logs that the JAVA_HOME directory is invalid (as mentioned before)

Upvotes: 0

Views: 79

Answers (0)

Related Questions