Setting up Android Studio on OS X

Datetime:2016-08-22 23:19:08          Topic: Android Studio           Share

Setting up Android Studio on OS X can be tricky. I had a strange problem with tools.jar file and I am not the only one .

I got an error, which looked like that:

'tools.jar' seems to be not in Android Studio classpath.  
Please ensure JAVA_HOME points to JDK rather than JRE.

Luckilly, I fixed this problem and set up Android studio in the following way in my .zshrc file.

If you are not using ZSH, you should set it up in your .bashrc or .bash_profile file.

# android
  export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk
  export ANDROID_HOME=$HOME/Library/Android/sdk
  export PATH=$ANDROID_HOME:$PATH
  export PATH=$ANDROID_HOME/tools:$PATH
  export PATH=$ANDROID_HOME/platform-tools:$PATH
  alias runAndroidStudio="/Applications/Android\ Studio.app/Contents/MacOS/studio"

Please, remember to set your version of JDK. If you have a different version than me, you need to change STUDIO_JDK variable respectively.

Complete source of my .zshrc file can be found here: https://github.com/pwittchen/dotfiles/blob/master/.zshrc

Then, I need to start Android studio, with the following command from terminal:

$ runAndroidStudio

Unfortunately, opening it via Spotlight or from Applications menu doesn’t work properly in my case. If you know, how to fix it, leave a comment below this article!

That’s it! With that setup, I can finally use Android Studio on Mac OS X.





About List