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 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 import a library from github on my project ( link: https://github.com/justasm/DragLinearLayout)
However, importing on this way:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.jmedeisis:draglinearlayout:1.1.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile files('libs/.jar')
}
on my gadle file doesn't work ( error: Failed to resolve: com.jmedeisis:draglinearlayout:1.1.0 ).
What are my solutions in this case? Is there a clean way to fix it or to import a github project otherwhise?
Gradle downloads binary from maven central repo by default not from github. And this package is not in maven central repo.
You can do those:
This package is in jcenter repository. Click to see the package
Add the following repository in your gradle file
repositories {
maven {
url "http://dl.bintray.com/elemyntic/android"
}
}
Clone The github project. and build it using gradle build, install it. use mavenLocal() in your repository. And you can use this artifact.
Following EROR's answer, I've succeed with something a bit easier by adding
allprojects {
repositories {
jcenter()
}
}
on my gradle file.
I am trying to learn Android and I tried to make an example from a tutorial. I have to include two libraries in the build.gradle, but when I sync the project with the gradle files it gives me this error: "Failed to resolve".
Here is the dependecies part from build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.loopj.android:android-async-http:1.4.4'
compile 'com.squareup.picasso:picasso:2.1.1'
}
Is there somethig wrong with the versions of the libraries or is it something else?
In your build.gradle you have to add:
repositories {
jcenter()
}
Gradle has to know where to download the aar files.
Pay attention to your example. You are using picasso:2.1.1.
It is a very old version.
Here you can find all releases of this library.
So it unable to resolve the jar! So I believe you missing jcenter() in your build.gradle. Your build.gradle should look like this
repositories {
jcenter()
}
And your'e using older version of picasso library, the new version is 2.5.2
Still if face the problem you can download the JAR and add to libs folder.
You can find jar from this link
1.download the jar file of picasso from this site square.github.io/picasso/
2.add the jar file to your app/lib folder
3.from android studio go to file/project structure/dependency then click on the blue + button then jar dependency from the lib folder select picasso at last press ok
in my case adding mavencentral to gradle worked
I took it from here
Could not find com.squareup.picasso:picasso:2.5.2
enter repositories {
jcenter()
mavenCentral()
}
I am adding this library to my project. I followed the instructions. I put th project under app/lib. the problem is when i add :
compile project(':lib:paralloid:paralloid')
compile project(':lib:paralloid:paralloidviews')
an error message in generated:
Error:(26, 0) Project with path ':lib:paralloid:paralloid' could not
be found in project ':app'.
Seems like you haven't specified mavenCentral() as a repository.
In build.gradle file, you need to specify which repository to use when resolving dependencies for building your project.
Add mavenCentral() repository in build.gradle file like this:
repositories {
mavenCentral()
}
And add library to your project
dependencies {
compile 'uk.co.chrisjenx.paralloid:paralloid:0.1.+'
}
Have you tried the other option they give?
dependencies {
compile 'uk.co.chrisjenx.paralloid:paralloid:0.1.+'
}