Question

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

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

in android studio.

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?

Was it helpful?

Solution

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.

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. In the pop-up, go into your Android SDK folder and click "Choose"
  3. Another pop-up will appear asking for which SDK and JDK you want to use. Choose any Android SDK and the 1.7 JDK.
  4. 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.

OTHER TIPS

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.

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.

I resolved this issue by doing the following:

  • Go to File -> Project Structure... -> Platform Settings -> SDKs
  • Select the SDK listed
  • Click on the ' - ' to remove it.
  • Restart Android Studio
  • Go to File -> Project Structure -> Platform Settings -> SDKs
  • Select the SDK listed
  • Click on the ' + ' to add it (follow path to your JDK HOME)
  • Restart Android Studio, and re-Build your Project.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top