I\'m running OSX 10.8 and was trying to run the Android Studio app bundle using a private jdk rather than one that is globally installed.
EDIT: I don\'t have any ja
For getting the app to start:
In spotlight see if you have a "java preferences".
From there you can add you own jdk/jre and let it be the one used by osx.
If you dont have it, you will need to install a java jre as in this question :
How to get back Java Preferences in OS X with Java for OS X 2012-006?
Then you should be able to get the "java preferences" app and add your custom jdk there
This should help you get started with project related sdk stuff.
I just check the executable script that starts android-studio, if you are arleady familiar with intellijIdea it is the same.
# ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): STUDIO_JDK, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
if [ -n "$STUDIO_JDK" -a -x "$STUDIO_JDK/bin/java" ]; then
JDK="$STUDIO_JDK"
elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
JDK="$JDK_HOME"
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
JDK="$JAVA_HOME"
else
JAVA_BIN_PATH=`which java`
if [ -n "$JAVA_BIN_PATH" ]; then
if [ "$OS_TYPE" = "FreeBSD" -o "$OS_TYPE" = "MidnightBSD" ]; then
JAVA_LOCATION=`JAVAVM_DRYRUN=yes java | "$GREP" '^JAVA_HOME' | "$CUT" -c11-`
As written in the comments of the bash scripts, just add a STUDIO_JDK environment variable with the absolute path of the desired JDK.
This is my ideaj.sh bash script which i stored in /etc/profile.d
export IDEA_JDK=/opt/jdk1.7.0_71
export STUDIO_JDK=/opt/jdk1.7.0_71
Add to /etc/bash.bashrc to automatically set the variables at every login.
source /opt/profile.d/ideaj.sh
All this should be applied to linux, on OS X can be a little different, but the theory is the same.
Another solution for OSX: go to the Applications folder, right click on Android Studio, choose "Show Package Contents".
Open the Info.plist file. Locate the JVMVersion key, and set the string value you need.
In my case, I needed to be 1.7 and up to be able to run the RoboVM plugin, and the value was 1.6*,1.7+, so I left it only on 1.7+.
Restart Android Studio and it should be using the version of the JVM you need.
This works if you have root access on your Mac.
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
here is explain link
Set the variable; ANDROID_STUDIO_JDK and use it for the path to your JDK.
source: http://www.reddit.com/r/Android/comments/1ee2ea/google_announces_android_studio_a_new_development/c9zfklt