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
Related
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 updated my Android studio, but after that, I cannot create a new project. My Android version is 2.2 beta 3.
This is an image of the error messages when attempting to create a Gradle sync project:
I was having the same problem, but I have fixed mine by removing this line of code from my Gradle module (app) level:
After removing to sync the project hopefully it will fix the problem.
Edit the dependencies in gradle app as:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
}
This worked for me :)
1.go to settings
2.select gradle option.
3.uncheck "offline work".
4.rebuild project.
5.that's it. make sure you have a internet connection.
Try adding the dependencies repositories in Project build.gradle
allprojects {
repositories {
google()
jcenter()
"Your dependencies repositorie"
}
}
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'm building an Android app in which I want to use the ActiveAndroid ORM. In the readme I read instructions on how to include it in Maven or ADT, but I'm using/trying to learn Android Studio with Gradle. So I guess I need to insert ActiveAndroid as a dependency. in my build.gradle file on these lines:
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
I don't really know what kind of string/url I should use so that Gradle can automatically find ActiveAndroid and compile it into my project.
Sicne I'm kinda lost; could anybody give me a tip here on how I should be tackling this?
[EDIT]
I now build the jar and compiled it using the suggested compile files('libs/ActiveAndroid.jar') (I have no version name in my jar file). It now builds successfully, but I still cannot import classes from it. See the image below:
Give this a go - download the JAR from here
Add it to your libs folder.
Change your dependancies to look something like this
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile files('libs/ActiveAndroid-3.3.jar')
}
Maybe this is new since this question was answered, but this is in the getting started guide:
Modify your build.gradle to include:
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
https://github.com/pardom/ActiveAndroid/wiki/Getting-started
Download the JAR from this link
OR
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
I can't answer the comment since I don't have enough rep yet, but make sure you sync your project with your gradle files again after adding the .jar to your dependencies.
Tools > Android > Sync Project with Gradle Files
Please make sure dependencies are added in individual module build.gradle file and NOT the common build.gradle file?
Also, under "Open Module Settings" make sure the dependencies are present under the "dependencies" tab of the app.
After you add the jar file to "libs" folder, build again and check if there is a build.gradle for ActiveAndroid module.This is what it should look like or a variation of this:
configurations.create("default")
def jarFile = file('ActiveAndroid.jar')
artifacts.add("default", jarFile)
Bit of an old question but having just run into this issue as I'm getting up to speed with both Android Studio/Gradle and AndroidActive, the documentation tells you what you need to add, but expects you to know how to add it. Basically in the build.gradle for the app (not the project). Add the repositories at the top of the file (if it doesn't exist already) and add the compile statement to the end of the dependencies section. I've attached screen shot of my Gradle file that worked.
My full build.gradle(app) with ActiveAndroid:
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.michaelpardo:activeandroid:+'
// other dependencies
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName '1'
multiDexEnabled true
}
}
Try these steps:
Go to this link - https://oss.sonatype.org/
Search for michaelpardo
A list which also include activeandroid would have came up
Click on the specific row and download the jar file
Put that jar file in libs folder and use Add to library option from Android Studio
Compile and it should work