Saturday, March 23, 2013

Robolectric java.lang.RuntimeException: Unable to find path to Android SDK

Error: Robolectric java.lang.RuntimeException: Unable to find path to Android SDK

Fix for MAC OSX Eclipse android project setup with Roboelectric unit test framework:

1) Add Android sdk dir to the bash_profile, first open the file:

sudo vim ~/.bash_profile 
then add the following line:

NOTE: replace ANDROID_SDK_PATH' with the android SDK file path i.e. path to android-sdk-mac_x86; e.g. in my case: ANDROID_SDK_PATH = /Applications/Dev/android-sdk-mac_x86

export ANDROID_HOME="ANDROID_SDK_PATH"
2) Create a file local.properties in the root directory of your Android project, and add the line:

 sdk.dir= ANDROID_SDK_PATH
 
Error should be fixed; Run your JUnit configuration test project now! ;)

1 comment:

  1. THANKS, For detailed information. It works awesome!!

    ReplyDelete