简体   繁体   English

由于jdk,在打开Android Studio(最新版本)时出错

[英]Error in opening Android Studio (latest version) because of jdk

Earlier I had jdk 7. Everything was working well with that. 之前我有jdk 7. I was able to open Android Studio as it was well configured with jdk 7 . 我能够打开Android Studio因为它已使用jdk 7进行了很好的配置。 I was able to create android project and gradle successfully. 我能够创建android项目并成功实现gradle

But while I clicked the run button to run the app in the AVD , it showed me the error that it was unable to compile the program (the program was a simple Hello World display). 但是,当我单击运行按钮以在AVD运行该应用程序时,它向我显示了无法编译该程序的错误(该程序是一个简单的Hello World显示)。 It said that it required jdk 8 to compile the program. 它说它需要jdk 8来编译程序。

So, I installed jdk 8 and the corresponding runtime and created the environment for the both successfully just like I had done for jdk 7 . 所以,我安装了jdk 8和相应的运行和创建的环境中两个成功就像我所做jdk 7 Now the Android Studio is not ready to start. 现在,Android Studio尚未准备好启动。

It shows the error that 它显示的错误是

jdk 8 is not a valid JVM. jdk 8不是有效的JVM。

I have also attached the screenshot of the error, the java environment variable on my machine and Java control panel showing the installed Java Version and runtime version. 我还附上了错误的屏幕快照,在我的机器和Java控制面板上显示了已安装的Java版本和运行时版本的java环境变量。 With jdk 7 , I was able to compile and run simple java program of hello world on command prompt. 使用jdk 7 ,我可以在命令提示符下编译并运行hello world的简单java程序。

Now, using jdk 8 , the program is getting compiled successfully creating an object file but it is not able to run the program. 现在,使用jdk 8可以成功编译该程序,以创建目标文件,但无法运行该程序。 Even in Control Panel, on opening 'Java', it shows that Java 8 has been successfully installed, configured and enabled on the system. 即使在“控制面板”中打开“ Java”,它也表明Java 8已在系统上成功安装,配置和启用。

I am not able to get the problem. 我无法解决问题。 The same problem was being faced with 8u91 . 8u91面临着同样的问题。 So, I also installed 8u92 . 因此,我还安装了8u92 Here are the screenshots I uploaded... 这是我上传的屏幕截图...

Android Studio Error Android Studio错误

Proper Environment Variable 适当的环境变量

Just specify till the jdk version 只需指定直到jdk版本

Dont include the bin folder 不包括bin文件夹

Edit your JAVA_HOME variable like this 像这样编辑您的JAVA_HOME变量

 C:\Program Files\Java\jdk1.8.0_45\

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM