I\'m trying to build my first project with Gradle and I think my gradle files and settings are correct.
I\'m using only one module and Support V4 + AppCompatBar libr
to echo @friederbluemle, you can also just launch the SDK manager from the command line if you have the Android SDK tools installed:
$ android
and then in the UI that pops up, select the tools/repositories that need to be installed -- in your case the support library repo
write following statement in your app's build.gradle file.
com.android.support:appcompat-v7:18.0.+
That's it
These dependencies don't exist in Maven Central (see this).
In addition to Kassim's answer:
As Peter says, they won't be in Maven Central
Either use maven-android-sdk-deployer to deploy the libraries to your local repository
Or from Android SDK Manager download the Android Support Repository (in Extras) and an M2 repo of the support libraries will be downloaded to your Android SDK directory
I also had to update the "Local Maven repository for Support Libraries" in Android SDK Manager.
If you are running on headless CI and are installing the Android SDK through command line, make sure to include the m2repository packages in the --filter
argument:
android update sdk --no-ui --filter platform-tools,build-tools-19.0.1,android-19,extra-android-support,extra-android-m2repository,extra-google-m2repository
Update
As of Android SDK Manager rev. 22.6.4 this does not work anymore. Try this instead:
android list sdk --all
You will get a list of all available SDK packages. Look up the numerical values of the components from the first command above ("Google Repository" and others you might be missing).
Install the packages using their numerical values:
android update sdk --no-ui --all --filter <num>
Update #2 (Sept 2017)
With the "new" Android SDK tools that were released earlier this year, the android
command is now deprecated, and similar functionality has been moved to a new tool called sdkmanager
:
List installed components:
sdkmanager --list
Update installed components:
sdkmanager --update
Install a new component (e.g. build tools version 26.0.0
):
sdkmanager 'build-tools;26.0.0'
Go to wherever you installed Android Studio (for me it's under C:\Users\username\AppData\Local\Android\android-studio\
) and open sdk\tools
, then run android.bat
. From here, update and download any missing build-tools and make sure you update the Android Support Repository and Android Support Library under Extras. Restart Android Studio after the SDK Manager finishes.
It seems that Android Studio completely ignores any installed Android SDK files and keeps a copy of its own. After running an update, everything compiled successfully for me using compile com.android.support:appcompat-v7:18.0.+