0

chinmay@chinmay-Latitude-E6420:~/MyFiles/FlutterExercise/again$ flutter build apk

Building without sound null safety For more information see https://dart.dev/null-safety/unsound-null-safety

ERROR: JAVA_HOME is set to an invalid directory: "/usr/lib/jvm/jdk-15-0.2"

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 138ms Gradle task assembleRelease failed with exit code 1 chinmay@chinmay-Latitude-E6420:~/MyFiles/FlutterExercise/again$

1 Answers1

0

There's something wrong with your environment configuration. Open Command Palette and choose Java: Configure Java Runtime.

Java Tooling Runtime --> Java Language Server, this option is equal to the setting "java.home". Java extension automatically detects the compatible jdk on local machine and lists the path here for user to choose. Make sure you've set JAVA_HOME properly on your local machine.

enter image description here

Don't forget to reload window to make the change effective.

Molly Wang-MSFT
  • 7,943
  • 2
  • 9
  • 22