Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable automatic download of missing Android SDK packages in Gradle

During Google I/O 2016's What's new in Android development tools a great new feature was quickly mentioned: Android Gradle plugin can now automatically download missing dependencies from Android SDK.

It's also mentioned in Android Gradle plugin 2.2.0-alpha4 release notes.

How do I enable it?

like image 972
Marcin Koziński Avatar asked Jul 12 '16 21:07

Marcin Koziński


People also ask

How do I fix Android SDK is missing or corrupted?

Quick fix: Go to the Tools –> SDK manager –> SDK tools. Deselect Hide obsolete packages option on the right bottom and further install Android SDK Tools(obsolete).

How do I download Android SDK alone?

You will need to download the Android SDK without Android Studio bundled. Go to Android SDK and navigate to the SDK Tools Only section. Copy the URL for the download that's appropriate for your build machine OS. Unzip and place the contents within your home directory.


2 Answers

In gradle.properties file in your project's root folder add the following line:

android.builder.sdkDownload=true

Note: at the time of writing this option is experimental. It looks like so far it downloads missing build tools and platforms, but doesn't attempt to update repositories where the support libraries or Google Play Services libraries live according to a bug report/feature request.

Edit: since now support libraries and other libraries from Google live on maven.google.com and not in local repositories, the note above isn't as important.

like image 99
Marcin Koziński Avatar answered Nov 06 '22 14:11

Marcin Koziński


I did:

gradle --refresh-dependencies

on the terminal, and it solved the problem.

like image 42
otumian Empire Avatar answered Nov 06 '22 14:11

otumian Empire