In a recent project, I created a Gradle project in windows, but when I load the project in Ubuntu and Mac OSX, an error “SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable”
I then followed the instruction, and in the ~/.bashrc file, I added the environment variable ANDROID_HOME
And then I sourced this file in the terminal:
When rebuilding the gradle model, the same problem persists!
To troubleshoot this, I then followed the instruction as shown in the first snapshot:
- Create a new file called local.properties in the root folder of the gradle project
- Edit the newly created local.properties file, add the single line as following:
where “/home/user/Android/adt/sdk” is the path where installed the Android SDK.
- Rebuild the model, now it works!
This approach is also applicable to Mac OSX!