Android Studio not using built in SDK

If you download Android Studio you’re probably ready to develop the apps instantly, because there is built in SDK (android) in the software. That’s sweet for new developers, not for me, because I have used Eclipse and sometimes I run this IDE too. And that means I already downloaded SDK, unzipped it in different path, download all important images and set up all virtual devices.

And there’s a problem. Even if I set up Android studio to use my SDK path, it sometimes doesn’t work and it uses Android Studio path (../android_studio/sdk/). That means I have to create demanded virtual device (and sometimes download correct API version images). And because Android Studio is EAP, the settings might not work and sometimes I’m not able to change the path.

Here’s the quick fix. Delete the SDK folder from Android Studio folder and create junction (in Windows). That means run command prompt (press button with windows logo at keyboard, type cmd, press enter) and type in this command:

MKLINK /J [destination path] [sdk path]

In my case it was:

MKLINK /J C:\Java\android_studio\sdk C:\Java\sdk

Here we are, problem succesfully solved.

junction

How to fix Android Studio which doesn’t start

Have you installed Android Studio and it doesn’t start after clicking the program icon? The fix is simple. Firstly, you should download (update to) the latest Java Development Kit (current version is 7u21).

One of my Java friends told me not to install Java (and anything Java related) to the default installation path because of spaces in the path (there’s a space in the Program Files) and have a special directory for Java like C:/Java/… Spaces in the path might cause errors.

I am punk so I am using the default paths anyway

Setting system variable – PATH

Notice: I will be working with Java path C:\Program Files\Java\jdk1.7.0_21\, it could be something else in your case, just check the path and if you have installed Java somewhere else, change it to desired destination.

android-studio-fix-10

Type SET PATH in commnad prompt, you should have something like C:\Program Files\Java\jdk1.7.0_21\bin in there. If not, open Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables and in System variables modify the PATH variable. Add C:\Program Files\Java\jdk1.7.0_21\bin to the end. Be sure there’s no space at the end of the line. See screenshots below.

Save the changes, you don’t need to restart computer, but you have to reload command prompt.

There might be a problem, check if you don’t have java.exe in the C:/Windows/System32/. If the file is in this location, you should rename (or delete if you are brave) it. Reload command prompt ant type java -version to check if everything is allright.

Set JAVA_HOME and JDK_HOME variables

JDK_HOME should be enough but someone experienced a problem without JAVA_HOME, so set them both for sure.

We are going to continue. Type SET JAVA and SET JDK to command prompt to check if the variables are set up. Are they not? Ok, you should add them to the system variables. Once again – Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables.

Add JDK_HOME and JAVA_HOME with value C:\Program Files\Java\jdk1.7.0_21\. Do you see the screenshot below? It won’t work because there’s a space left at the end of value line! Check it and save it.android-studio-fix-05

And that’s it, you are ready to go, everything should be set up and Android Studio should start right after you click the icon.