Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Emulator - Java instance does not support 32 bit JVM

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?

like image 455
Patrick Avatar asked Mar 09 '14 09:03

Patrick


1 Answers

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.
like image 75
Maxwell Avatar answered Oct 17 '22 08:10

Maxwell