Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle, Android and the ANDROID_HOME SDK location

People also ask

How do I find Android SDK location?

On a machine with Android Studio installed, click Tools > Android > SDK Manager. At the top of the window, note the Android SDK Location.

Where is Android gradle plugin located?

gradle file, located in the root project directory, defines dependencies that apply to all modules in your project. By default, the top-level build file uses the plugins block to define the Gradle dependencies that are common to all modules in the project.

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 studio gradle installed?

The Gradle plugin (which includes a packaged version of gradle) should already be installed at where/you/installed/android-studio/plugins/gradle, so you shouldn't need to download it manually. That last directory may be where/you/installed/android-studio/gradle/gradle-1.1.


I've solved the problem. This works for me:

In

/my_current_project/

I've created a file called local.properties and put inside

sdk.dir=/my_current_path_to/sdk

In the console I need to do

set ANDROID_HOME=/my_current_path_to/sdk

Hope this helps.


On OSX, IntelliJ won't pick up the environment variables you set in your .bash_profile or .bash_rc etc...

Try this, substituting the value of your own sdk location:

launchctl setenv ANDROID_HOME /usr/local/opt/android-sdk

Then restart IntelliJ and Bob's your uncle.

Here is a reference to the problem, stated more generally: https://emmanuelbernard.com/blog/2012/05/09/setting-global-variables-intellij/


In my case settings.gradle was missing.

Save the file and put it at the top level folder in your project, even you can copy from another project too.

Screenshot reference:

enter image description here

Hope this would save your time.


This works for me:

$ export ANDROID_HOME=/path_to_sdk/
$ ./gradlew

The Android Gradle plugin is still in beta and this may simply be a bug. For me, setting ANDROID_HOME works, but we may be on different versions (please try again with the most recent version and let me know if it works or not).

It's also worth setting the environment variable ANDROID_SDK as well as ANDROID_HOME.

I have seen issues with this on some machines, so we do create local.properties in those cases - I have also noticed that the latest version of Android Studio will create this file for you and fill in the sdk.dir property.

Note that you shouldn't check local.properties into version control, we have added it to our gitignore so that it doesn't interfere with porting the code across systems which you rightfully identified as a potential problem.


For whatever reason, the gradle script is not picking up the value of ANDROID_HOME from the environment. Try specifying it on the command line explicitly

$ ANDROID_HOME=<sdk location> ./gradlew

I faced the same issue, though I had local.properties file in my main module, and ANDROID_HOME environment variable set at system level.

What fixed this problem was when I copied the local.properties file which was in my main project module to the root of the whole project (i.e the directory parent to your main module)

Try copying the local.properties file inside modules and the root directory. Should work.