Search code examples
androidmacosintellij-idealibgdx

IntelliJ IDEA unable to find android sdk


I'm trying to import a libGDX project into IntelliJ running OSX 10.9. When creating my own project it's not an issue specifying the path to the android sdk in the gdx-setup, but when importing one I keep getting the issue:

SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

Screenshot

I haven't found anything resembling a local.properties file and wouldn't know how to create one, so I set the ANDROID_HOME environment variable with the path to my android sdk, adding this to my .bash_profile: export ANDROID_HOME=/Applications/android-sdk Additionally I added $ANDROID_HOME:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools to my PATH as well, which seems somewhat overkill, but unfortunately the PATH isn't recursive.

IntelliJ isn't getting any of this however, I'm guessing adding it to my .bash_profile isn't the right way of doing it?

Thank you very much in advance!


Solution

  • So thanks to the friendly people in the libGDX IRC it turned out to be relatively easy adding the local.properties file. The necessary content is just

    sdk.dir=/path/to/android/sdk

    This solves the problem and IntelliJ is now able to import the project. No further info on using environment variables.