英文:
Android Studio doesn't start on WSL (No JRE found)
问题
Step 1. 在我的WSL上安装了Java,通过运行以下命令:
sudo apt install default-jdk
当我运行 java --version 时,它显示 openjdk 11.0.18 2023-01-17。
Step 2. 在我的Windows 10上安装了 VcXsrv X Server,并进行了配置以确保它正常工作(我成功地通过在终端中运行 "xcalc" 启动了Ubuntu的计算器)。
Step 3. 下载了Android Studio的Linux包并解压到我的主目录子文件夹中。
现在我试图通过运行 "sh studio.sh" 来启动它,但出现了来自VcXsrv X Server的错误消息:
无法启动Android Studio:未找到JRE。请确保$STUDIO_JDK、$JDK_HOME或$JAVA_HOME指向有效的JRE安装。
我应该怎么做?它是否需要我在Windows上安装JDK并在那里设置环境变量?
英文:
Step 1. Installed java on my WSL by running
sudo apt install default-jdk
when I run java --version it gives me openjdk 11.0.18 2023-01-17
Step 2. Installed VcXsrv X Server on my Windows 10. Configured it so I'm sure that it works (I mananged to start Ubuntu's calculator on it by running "xcalc" in the terminal)
Step 3. Downloaded Android Studio linux package and unzipped it in my home directory subfolder.
Now I am trying to start it by running "sh studio.sh" but an error from VcXsrv X Server is popping out:
> Cannot start Android Studio: No JRE found. Please make sure
> $STUDIO_JDK, $JDK_HOME, or $JAVA_HOME point to valid JRE installation.
What am I supposed to do? Does it need me to install JDK on Windows as well and set env variables there?
答案1
得分: 1
我在寻找解决方法时遇到了这个错误和这个问题。
您可以通过将$STUDIO_JDK
变量设置为$JAVA_HOME
路径来解决此问题。希望这对您也有所帮助。
英文:
I encountered this error and this question while searching for a solution.
You can fix this by instead setting the $STUDIO_JDK
variable to the $JAVA_HOME
path. Hope this helps you also.
答案2
得分: 0
Running java binary does not tell you about JAVA_HOME variable. Run echo $JAVA_HOME to see if it's present, if not check here how to set it: https://stackoverflow.com/questions/24641536/how-to-set-java-home-in-linux-for-all-users
英文:
Running java binary does not tell you about JAVA_HOME variable. Run echo $JAVA_HOME to see if its present, if not check here how to set it: https://stackoverflow.com/questions/24641536/how-to-set-java-home-in-linux-for-all-users
答案3
得分: 0
我曾经在同一个位置待了几个星期,但我成功通过将Studio降级到版本2021.1.1和运行sudo apt install openjdk-11-jre
来降级Java到版本11来解决了这个问题。有关如何以及何时执行此操作,请查看此链接。
我的下一步是找出我可以使用的最新版本,而不会破坏现在正常运行的内容。
英文:
I was in the same position for weeks, but I managed to get round it by downgrading Studio to version 2021.1.1
And downgrading java to version 11 by running sudo apt install openjdk-11-jre
. Check this out for further info on how and when to do this.
My next steps is to find out which is the latest version of each that I can use without breaking what now works.
答案4
得分: 0
I had the same issue but this helps me: 在Windows 10子系统Linux上运行Android Studio.
Main point:
- 除了VcXsrv之外,还需要在Unix端安装xfce4。
- 使用以下命令安装缺失的库:
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
。 - 我还在
/etc/profile
中添加了export DISPLAY=:0
,而不是在文章中所说的export DISPLAY=[unix ip]:0
。
经过这一切,我成功在WSL上运行了Android Studio。
英文:
I had the same issue but this helps me: Can I run android studio on windows 10 Subsystem Linux.
Main point:
- In addition to VcXsrv you need to install xfce4 on the unix side
- Install missing libraries with:
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
- I also added
export DISPLAY=:0
in/etc/profile
instead ofexport DISPLAY=[unix ip]:0
like it says in the article
After all this I managed to run android studio on WSL
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论