Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDK location not found. ANDROID_HOME - building a gradle project in eclipse on a MAC

I'm in the process of running through a tutorial on getting Libgdx working with eclipse on my MAC.

I am currently building one of the example projects using gradle in eclipse so I can run through the tutorials and learn a bit more. When I import and build the example code project (I'm using a MAC) I get the below error message:

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

In an attempt to resolve this problem I have attempted and checked the following:

1) Installed the latest version of the JDK and setup JAVA_HOME - confirmed existence by echoing the variable from a terminal.

2) Installed the latest and various other versions of the android SDK and plugins and setup ANDROID_HOME. - Confirmed by checking the Android Studio SDK location and echoing $ANDROID_HOME

3) I also found this thread and the suggested solution was to update local.properties with sdk.dir which I have also tried and I still get the same error:

Gradle, Android and the ANDROID_HOME SDK location

4) I have setup the eclipse android preferences to make sure it is looking at ANDROID_HOME and it can see the various SDK folders.

I have also made a few attempts to add the --stacktrace options via android studio however that hasn't seemed to produce output in eclipse.

I'm going to try building the project via the commandline outside eclipse now and see if that works.. Has anyone come across this issue before?

Phill

like image 556
Phill Ash Avatar asked Jun 02 '15 07:06

Phill Ash


People also ask

How do I fix sdk location not found?

Close the current project and you'll see a pop-up with a dialog which will then proceed to Configure option. Configure -> Project Defaults -> Project Structure -> SDKs on left column -> Android SDK Home Path -> give the exact path as you did on local. properties and select Valid Target.

Where is Android SDK location in Mac?

Generally, the Android SDK is installed in the /Users/user-name/Library/Android/sdk folder on macOS.

What is sdk location in eclipse?

Open eclipse, click window tab it will show a drop down menu, click preferences, in preferences window click Android, here u go Sdk location is right in front of u copy the address :) Show activity on this post.


1 Answers

I finally fixed this after 10 hours of racking my brains and trying every solution under the sun.

The solution was to set the sdk.dir in the local.properties file as the error suggested. Where I was going wrong was the location of the local.properties file.

This must be in the projects root folder (i.e where settings.gradle, gradlew and gradlew.bat are) as the below thread suggests!

Where does local.properties go for android project?

like image 85
Phill Ash Avatar answered Sep 19 '22 23:09

Phill Ash