I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:25.4.0'
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:25.4.0
I got that the support code from the android support design library and added it to a new project. I added it to the dependency section as such:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.4.0'
}
Any ideas on what I'm doing wrong?
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support
repository from the SDK Manager. For more information, see Support
Library Setup.
Step 1: Open the build.gradle file for your application.
Step 2: Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Step 3: Add the support library to the dependencies section. For example, to add the v4 core-utils library, add the following lines:
dependencies {
...
compile "com.android.support:support-core-utils:25.4.0"
}
A more updated version of the answer of "Bhavesh Patadiya" :
In your project build.gradle file, add google() into the repositories blocks:
repositories {
jcenter()
google()
}
Update the same file with a newer Gradle version:
classpath 'com.android.tools.build:gradle:2.3.3'
If the above cause you new issues or the same issue, exit Android-Studio, and delete the "gradle" folder/s (maybe also ".gradle" folder) and the "build" folder and sub-folders, and then open Android-Studio again.
Mr. Bhavesh Patadiya give us a good solution. However, I'd like to share something more, to make fix process more explicit.
There are two "build.gradle" files under the project directory. Their pathes are to be "Your-project-root-dir/build.gradle" and "Your-project-root-dir/app/build.gradle" respectively. When you see the error information in your android studio, and try to trace the file, you will probably open the second one.
You should add this statement in the first file ("Your-project-root-dir/build.gradle").
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
and add the statements in the second build.gradle ("Your-project-root-dir/app/build.gradle")
dependencies {
...
compile "com.android.support:support-core-utils:27.0.2"
}
Always keep appcompact version and support lib versionssame, so change com.android.support:design:25.4.0 to com.android.support:design:25.3.1
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
You need to update the android support Repository in the SDK manager . Also the Design Library depends on the Support v4 and AppCompat Support Libraries.
Same version android support must be the same with others..
compile 'com.android.support:appcompat-v7:25.3.1' <-- same
compile 'com.android.support:design:23.3.1' <-- same
after adding :
maven {
url "https://maven.google.com"
}
make sure your Gradle sync is on ONLINE mode
you can check it from:
Android studio -> Preferences -> Build, Execution, Deployment ->
Gradle -> Offline work (make sure this check box is not selected)
This problem occurs when there is andoridtestImplementation is added in app.build.
Remove testImplementation,androidTestImplementation from the app.build, that solves this issue.
Above answers did't resolve anything for me.
Tried syncing the project- Failed.
Tried building the project -Failed
Problem found :
Sdk Support Repository was corrupted
.
Fix:
Go to the SDK manager, click the "SDK Tools" tab. If the check-mark
for "Support Repository" is selected, unselect it and click OK. This
will delete all of the files in the repository. Then recheck the
check-mark, click GO and reinstall the repository.
If you still have the issue, check the project settings for offline mode. if offline mode is on, then off and sync the project. That fixed my issue.
There is no library by that name. There is com.android.support:recyclerview-v7:25.4.0.
Failed to resolve com.android.support:support-compat:25.4.0
Failed to resolve com.android.support:support-core-ui:25.4.0
I am trying to include this library to my project by adding
compile 'jp.wasabeef:recyclerview-animators:2.2.7'
so remove this line from gradle
my error just resolved
I applied to my project Android Architecture Components, by adding this lines to build.gradle:
// Android Architecture Lifecycle
compile "android.arch.lifecycle:runtime:1.0.0-alpha1"
compile "android.arch.lifecycle:extensions:1.0.0-alpha1"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"
// Android Architecture Room
compile "android.arch.persistence.room:runtime:1.0.0-alpha1"
compile "android.arch.persistence.room:rxjava2:1.0.0-alpha1"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1"
It worked, but after updating Android Studio to Canary 3 version I'm still getting this error while compiling
Error:org.gradle.api.resources.ResourceException: Could not get
resource
'https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom'.
Error:org.gradle.api.UncheckedIOException: Could not HEAD
'https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom'.
Received status code 401 from server: Unauthorized
... other poms from library with the same error.
I tried restarting Android Studio, uninstalling app and of course clean-rebuild.
You need to add the new public Maven repo that Google is using to your build.gradle file.
For example, you could add it to the allprojects closure in the top-level build.gradle file:
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
Then, all of your modules (e.g., app/) will know to look there in addition to other places for the artifacts.
From your error message, it would appear that Android Studio is only looking in jitpack.io.
compile 'com.github.RogaLabs:social-login:1.2.1'
compile 'com.github.mukeshsolanki:social-login-helper:1.0.2'
compile 'com.github.robertsimoes:Shareable:0.1.0'
compile 'com.github.fccaikai:BottomMenuTutorial:1.0.1'
I tried some other libraries too, they were also giving such type of errors but when I used Glide or Picasso library they synced perfectly.
but getting following error
I am using Gradle version: 2.14.1
At first make sure you add jitpack.io in build.gradle Root level Section .
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
After that Clean-Rebuild and Run .
I have an android library uses a module on jitpack, so I change my gradle.build
apply plugin: 'com.android.library'
repositories {
mavenCentral()
// jitpack maven
maven {
url "https://jitpack.io"
}
}
...
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.3.0'
// this is the library
compile 'com.github.ybq:Android-SpinKit:1.0.4'
}
But gradle still can't resolve this library
Error:Failed to resolve: com.github.ybq:Android-SpinKit:1.0.4
Did I missed something ?
A simple answer is that this library is not available in the gradle. Kindly recheck if you are spelling this dependency correctly. This library might be removed by the provider so its not working.
Works fine here.
Try running with -i or -d to get more information about what is happening.
Or maybe now it works and it was a temporary problem? If so, try running with --refresh-dependencies which makes Gradle forget about whether a repository has a dependency or not and requeries it.
I'm trying to set up Android unit testing following this tutorial: http://www.peterfriese.de/android-testing-with-robolectric/
But then I realized I don't know enough about the build system to understand what's really going on.
So I have some questions about part of my build.gradle below
buildscript {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'
}
}
and
dependencies {
compile 'com.android.support:appcompat-v7:+'
testCompile 'junit:junit:4.10'
testCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
testCompile 'com.squareup:fest-android:1.0.+'
instrumentTestCompile 'junit:junit:4.10'
instrumentTestCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
instrumentTestCompile 'com.squareup:fest-android:1.0.+'
}
When I do classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT', how does Gradle know where com.squareup.gradle is?
Also, right now, I get an error saying Gradle can't find the Robolectric library org.robolectric:robolectric:2.3-SNAPSHOT. Is it something I have to manually add or is the build system supposed to somehow automatically take care of it?
Gradle will find com.squareup.gradle from the configured repositories -- since it doesn't exist in Maven Central, it'll look in the Sonatype repo and find it there.
The Robolectric library should be available to Gradle, as visiting the snapshot repository URL manually shows it to be there. You could have an earlier version cached: mark the repository as 'changing', refresh dependencies, or simply rm -rf .gradle/caches to force Gradle to look again. See this answer for more: How can I force gradle to redownload dependencies?