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
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 am trying to use some of the awesome android arsenal libraries. For example: https://android-arsenal.com/details/1/703. If you go to main page and the package page it gives instructions on what to add to the build.gradle file. I recently updated Android Studio and the build.grade files are now in the same "Gradle Scripts" Tab. I want to know where to put the lines:
// stock actionBar
compile 'com.balysv.materialmenu:material-menu:1.x.x'
// Toolbar and ActionBarCompat-v21 (includes support-v7:21.0.x)
compile 'com.balysv.materialmenu:material-menu-toolbar:1.x.x'
// actionBarCompat-v20 (up to support-v7:20.0.0 - does not support Toolbar)
compile 'com.balysv.materialmenu:material-menu-abc:1.x.x'
// actionBarSherlock
compile 'com.balysv.materialmenu:material-menu-abs:1.x.x'
and/or
repositories {
maven {
url "https://jitpack.io"
}
}
and
dependencies {
compile 'com.github.balysv:material-menu:v1.5.1'
}
I am confused because of the two build.gradle files listed here:
The Project:Socio file looks like this:
The Module:app file looks like this:
You should put all dependencies in the module/build.gradle file.
For example
compile 'com.balysv.materialmenu:material-menu:1.x.x'
compile 'com.balysv.materialmenu:material-menu-toolbar:1.x.x'
compile 'com.github.balysv:material-menu:v1.5.1'
About the repositories you can put it in the top level o in module gradle file. It depends if any project uses the same repos.
For example: root/build.gradle
allprojects{
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
or module/build.gradle
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
Put them in the Module:app gradle file.
The other gradle file is for project-wide build configuration. From the documentation:
Android Studio projects contain a top-level project Gradle build file that allows you to add the configuration options common to all application modules in the project. Each application module also has its own build.gradle file for build settings specific to that module.
I'm trying to import the drag-sort-listview android library into my application in Android Studio. I had no problems using it with Eclipse before.
Git repository for library: https://github.com/bauerca/drag-sort-listview
Nowadays, you can just add the dependency in your build.gradle as:
repositories {
mavenCentral()
}
dependencies {
compile 'asia.ivity.android:drag-sort-listview:1.0'
}
All you need to do is to define the dependency on it in your build.gradle file.
repositories {
mavenCentral()
}
dependencies {
compile 'asia.ivity.android:drag-sort-listview-apklib:1.0#apklib'
}
I am trying to import android-swipelistview (https://github.com/47deg/android-swipelistview) into my Android Studio module using gradle. Shouldn't this be possible with build.gradle config alone? Does anyone have a config file(s) that does the job?
You can use:
compile 'com.nineoldandroids:library:2.4.0'
or if you have the library copied to your project libs directory, you can use:
compile files ('libs/ nineoldandroids-2.4.0.jar')
However, you can check out my post on getting started with swipelistview:
http://modewagon.wordpress.com/2013/09/16/getting-started-with-swipelistview/
I was getting a Failed to Resolve error on this library. The fix for me was, in the build.gradle file, to change this:
repositories {
mavenCentral()
}
to this:
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
If compile 'com.nineoldandroids:library:2.4.0+' doesn't work,
try this -> compile 'com.nineoldandroids:library:2.4.+'