Android library project can not resolve jitpack dependency - android

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.

Related

Failed to resolve: com.android.support.design:25.4.0

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

gradle android studio 2.3: failed to resolve 'com.google.code.gson:gson:2.8.0'

i'm facing the gradle error failed to resolve while including gson libraries.
I already checked for similar problem here, here and here but none of the solution proposed was suitable to me, i continue receiving the same error.
My build.gradle module:
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.code.gson:gson:2.8.0'
}
build.gradle project
buildscript {
repositories {
mavenCentral()
jcenter()
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
As suggested in the answers it should be enough jcenter repository, as it is a superset of mavenCentral, i tried also different versions of gson, adding "+" et cetera but nothing is working.
Thanks in advance guys :)
try using this in your app level build.gradle file
compile 'com.google.code.gson:gson:2.7'
Dear Fabio Add like this
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.code.gson:gson:2.8.0'
see in attached snap
Thanks
Try put this line in the build.gradle (Module:app) inside dependecies:
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
Here is an example:
Example project with the gson library added
Try using the previous version of library , if still not working then download the .jar library file from Here and add it to your project. Also check out the possible solutions over here

Dependency from github is not resolved on gradle, what to do in this case?

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.

android design library gradle null pointer exception

I'm trying to add android.support.design library to my project: All the interesting things in my gradle file:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.android.support:support-v13:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:cardview-v7:22.1.0'
}
I'm getting
Error:Android Gradle Build Target: java.lang.NullPointerException
When removing com.android.support:design:22.2.0 (and adding back v4 and AppCompat), build is successful.
Another similar issue didn't help me
Notice that i'm building using Intellij 14
I ran the app using android studio and not IntelliJ 14 and got a different error:
`Error:(1) Attribute "insetForeground" has already been defined`
So if someone is running IntelliJ 14, until next update of Intellij 14 I guess It's safer to use android studio 1.3.+ (or at least check for errors using android studio.
If one get the same error.
go to attr.xml and remove declare-styleable name="ScrimInsetsView"
using ctrl-shift-f search for insetF and remove app:insetForeground attribute from all the layout that contains such attribute.
Everything should work OK now
I had exactly the same issue. I guess it comes from an combination of mismatching parameters in grade and your xml resources..
Maybe this will help (for me it did):
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
}
}
apply plugin: 'com.android.application'
...
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
}
Give the build.grade the 1.1.1, too (just in case)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
}
}
allprojects {
repositories {
jcenter()
}
}
Hopefully the next sync, clean and rebuild will pass (or fire a meaningful error message like 'color-res blabla not found').
Btw: From time to time my IntelliJ is setting itself to other Java-configs (e.g. Java8 with lambdas) - so "just in case":
Don't forget to check if your project SDK is set up correctly (File > Project-structure > project > choose the SDK).

How to import remote library in Android Studio using gradle?

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.+'

Categories

Resources