Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 481
Kilian Avatar asked Jan 23 '26 02:01

Kilian


2 Answers

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.

like image 64
Kilian Avatar answered Jan 25 '26 14:01

Kilian


This is unorthodox but I cannot comment(not enough karma) so I'm writing an answer instead, where is the local.properties file that you speak of? I am unable to find it.

However I've solved it by:

  • open your Project Structure settings (Ctrl+alt+shift+s)
  • Under the Platform Settings group select SDKs
  • with the + sign add Android SDK > Select your /path/to/android/sdk
  • Select build target
    • Optional : I've also named the sdk as 'android' I am unsure whether this fixed anything but it does make sdk's ambiguous
  • Apply
  • Go to Project Settings and choose Modules
  • Select android and under Module Sdk choose the android sdk we just added (renaming can come in handy here).
  • Apply, wait and done.
like image 40
Salyangoz Avatar answered Jan 25 '26 16:01

Salyangoz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!