我安装了Android Studio 4.1,并尝试运行现有的项目。但是它会给出这样的错误:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.发布于 2021-05-14 05:56:21
您必须设置JAVA_HOME环境变量。
在Windows上,我解决了以下问题:
- Open Windows Search, type in “env”, and choose “Edit the system environment variables”.
- Click on "Environment Variables...".- Click on "New".- Fill in the "variable name" field with "JAVA\_HOME".- Fill in the "variable value" with the path to where Java is installed on your computer. (for me it was under "C:\Program Files\Java\<jdkversion>")
- Click "OK" and close all dialogs.发布于 2020-10-20 07:20:06
在装有Android 4.1的Ubuntu 20.04上,可以使用Snap版本解决此错误:
flutter config --android-studio-dir=/snap/android-studio/current/android-studio发布于 2020-10-15 23:12:18
您需要安装android studio所需的Java JDK软件。
sudo apt install openjdk-11-jdkhttps://stackoverflow.com/questions/64359564
复制相似问题