Android Studio仿真器- Java实例不支持32位JVM

时间:2023-01-02 20:13:03

I am running android studio on a Mac os x maverick. I have installed the 64bit JDK. When I run the emulator I get the message

我在Mac os x maverick上运行android studio。我已经安装了64位JDK。当我运行模拟器时,我得到消息

Error:Abnormal build process termination:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.

错误:异常构建过程终止:错误:此Java实例不支持32位JVM。请安装所需的版本。

in android studio.

在android工作室。

java -version

returns

返回

version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

and

$JAVA_HOME

points to

指出

/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home

So every thing seems to be fine. What could possibly be wrong?

所以一切似乎都很好。有什么可能是错的?


Update:

I still had an old jdk1.6 lying around on my mac. When removing it Android Studio was asking to install Java 6 again. So apparently Android Studio needs Java 6 to compile (as confirmed by Andrew in the comment of this question). Hoping that it would install the x64 version I let it install Java 6. However I still wasn't successful afterwards. I neither could find Java 6 for Mac OS X 64 Bit. Any hints on that?

我的mac电脑上还有一台旧的jdk1.6,当移除它的时候,Android Studio再次要求安装Java 6。显然Android Studio需要编译Java 6(正如Andrew在这个问题的评论中所证实的那样)。希望它能安装x64版本,我让它安装Java 6。但是我还是没有成功。我也找不到Mac OS X 64位的Java 6。有什么提示吗?

3 个解决方案

#1


11  

Android Studio can run on whatever it needs, but the error seems to be pointing to the SDK that the project is using. To check what your project is using, go into Project Structure > Project Settings > Project. You should now see the Project SDK. It should say something like "Android API ## Platform (java version "1.7.[current version number]"). If it doesn't say 1.7.[current version number], then it probably needs to be updated.

Android Studio可以在任何需要的地方运行,但是错误似乎指向了项目正在使用的SDK。要检查项目正在使用什么,请进入项目结构>项目设置>项目。现在应该看到项目SDK。它应该是“Android API #平台(java版本)”1.7。(当前版本号)”)。如果不是1。7。[当前版本号],那么它可能需要更新。

Here's what you can do to update it:

以下是你可以做的更新:

  1. In Project Structure > Platform Settings > SDKs, click the "+" button to add a new SDK.
  2. 在项目结构>平台设置> SDKs中,点击“+”按钮添加新的SDK。
  3. In the pop-up, go into your Android SDK folder and click "Choose"
  4. 在弹出窗口中,进入Android SDK文件夹,点击“选择”
  5. Another pop-up will appear asking for which SDK and JDK you want to use. Choose any Android SDK and the 1.7 JDK.
  6. 另一个弹出窗口将询问您希望使用哪个SDK和JDK。选择任何Android SDK和1.7 JDK。
  7. Go to Project Structure > Project Settings > Project and change your Project SDK to the one you just created. You should see the name of the SDK with the new Java version that you installed.
  8. 转到项目结构>项目设置>项目,并将项目SDK更改为您刚刚创建的项目。您应该在安装的新Java版本中看到SDK的名称。

#2


1  

I am not sure but I think that sometimes the error is actually stating a falsehood, and is misleading.

我不确定,但我认为,有时错误实际上是说了一个谎言,是误导。

I agree with @Maxwell inasmuch as the problem is a mismatch between the JDK configured for the project and the JDK that IntelliJ is running under.

我同意@Maxwell,因为问题是为项目配置的JDK和IntelliJ运行的JDK之间的不匹配。

The specific problem I encountered was Running IntelliJ 13.1.1 with 1.6.0_65 ... x86_64 while compiling a project configured with a Java 7 x64 JDK. Reconfiguring the project to an x64 Java 6 JDK put out the fire.

我遇到的具体问题是使用1.6.0_65运行IntelliJ 13.1.1…在编译使用Java 7 x64 JDK配置的项目时,x86_64。将项目重新配置为x64 Java 6 JDK会导致火灾。

#3


0  

I resolved this issue by doing the following:

我通过以下方式解决了这个问题:

  • Go to File -> Project Structure... -> Platform Settings -> SDKs
  • 进入文件->项目结构…->平台设置-> SDKs
  • Select the SDK listed
  • 选择列出的SDK
  • Click on the ' - ' to remove it.
  • 单击“-”以删除它。
  • Restart Android Studio
  • 重新启动Android工作室
  • Go to File -> Project Structure -> Platform Settings -> SDKs
  • 进入文件->项目结构->平台设置-> SDKs
  • Select the SDK listed
  • 选择列出的SDK
  • Click on the ' + ' to add it (follow path to your JDK HOME)
  • 单击“+”添加它(按照JDK HOME的路径)
  • Restart Android Studio, and re-Build your Project.
  • 重新启动Android Studio,重新构建项目。

#1


11  

Android Studio can run on whatever it needs, but the error seems to be pointing to the SDK that the project is using. To check what your project is using, go into Project Structure > Project Settings > Project. You should now see the Project SDK. It should say something like "Android API ## Platform (java version "1.7.[current version number]"). If it doesn't say 1.7.[current version number], then it probably needs to be updated.

Android Studio可以在任何需要的地方运行,但是错误似乎指向了项目正在使用的SDK。要检查项目正在使用什么,请进入项目结构>项目设置>项目。现在应该看到项目SDK。它应该是“Android API #平台(java版本)”1.7。(当前版本号)”)。如果不是1。7。[当前版本号],那么它可能需要更新。

Here's what you can do to update it:

以下是你可以做的更新:

  1. In Project Structure > Platform Settings > SDKs, click the "+" button to add a new SDK.
  2. 在项目结构>平台设置> SDKs中,点击“+”按钮添加新的SDK。
  3. In the pop-up, go into your Android SDK folder and click "Choose"
  4. 在弹出窗口中,进入Android SDK文件夹,点击“选择”
  5. Another pop-up will appear asking for which SDK and JDK you want to use. Choose any Android SDK and the 1.7 JDK.
  6. 另一个弹出窗口将询问您希望使用哪个SDK和JDK。选择任何Android SDK和1.7 JDK。
  7. Go to Project Structure > Project Settings > Project and change your Project SDK to the one you just created. You should see the name of the SDK with the new Java version that you installed.
  8. 转到项目结构>项目设置>项目,并将项目SDK更改为您刚刚创建的项目。您应该在安装的新Java版本中看到SDK的名称。

#2


1  

I am not sure but I think that sometimes the error is actually stating a falsehood, and is misleading.

我不确定,但我认为,有时错误实际上是说了一个谎言,是误导。

I agree with @Maxwell inasmuch as the problem is a mismatch between the JDK configured for the project and the JDK that IntelliJ is running under.

我同意@Maxwell,因为问题是为项目配置的JDK和IntelliJ运行的JDK之间的不匹配。

The specific problem I encountered was Running IntelliJ 13.1.1 with 1.6.0_65 ... x86_64 while compiling a project configured with a Java 7 x64 JDK. Reconfiguring the project to an x64 Java 6 JDK put out the fire.

我遇到的具体问题是使用1.6.0_65运行IntelliJ 13.1.1…在编译使用Java 7 x64 JDK配置的项目时,x86_64。将项目重新配置为x64 Java 6 JDK会导致火灾。

#3


0  

I resolved this issue by doing the following:

我通过以下方式解决了这个问题:

  • Go to File -> Project Structure... -> Platform Settings -> SDKs
  • 进入文件->项目结构…->平台设置-> SDKs
  • Select the SDK listed
  • 选择列出的SDK
  • Click on the ' - ' to remove it.
  • 单击“-”以删除它。
  • Restart Android Studio
  • 重新启动Android工作室
  • Go to File -> Project Structure -> Platform Settings -> SDKs
  • 进入文件->项目结构->平台设置-> SDKs
  • Select the SDK listed
  • 选择列出的SDK
  • Click on the ' + ' to add it (follow path to your JDK HOME)
  • 单击“+”添加它(按照JDK HOME的路径)
  • Restart Android Studio, and re-Build your Project.
  • 重新启动Android Studio,重新构建项目。