hsi
hsi

Reputation: 97

How to set SDK directory in gradle project

I want to set the default SDK for all projects because when I open a gradle project this error appears:

The SDK directory 'D:\androidproject\com.guvery.notifyme_15_src\com.guvery.notifyme_15_src.tar.gz\home\vagrant\android-sdk' does not exist. Please fix the 'sdk.dir' property in the local.properties file.

image with the error

How can I fix it?

Upvotes: 1

Views: 5730

Answers (2)

Vincent Gerris
Vincent Gerris

Reputation: 7537

According to the documentation:

https://docs.gradle.org/current/userguide/build_environment.html

Add this to gradle.properties

org.gradle.java.home=/path/to/your/java/home

It doesn't seem to work though for Android at least. Setting local.properties with the proper path should work, another option can be to set JAVA_HOME to that path and for Android the ANDROID_HOME variable like e.g. :

export ANDROID_HOME=$HOME/Library/Android/sdk
#export PATH=$PATH:$ANDROID_HOME/emulator
#export PATH=$PATH:$ANDROID_HOME/platform-tools

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364730

In a single project, open the local.properties file and set the

sdk.dir=/home/myFolder/androidSdk

To change the sdk dir for all project, in Android Studio.
File -> Other Setting -> Default project structure

enter image description here

Upvotes: 2

Related Questions