问题
I'm trying to import a library using jitpack.io. Here's my top-level build.gradle
:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
and here's my app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.domain.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile files('libs/Parse-1.9.1/Parse-1.9.1.jar')
compile files('libs/Parse-1.9.1/bolts-android-1.2.0.jar')
compile 'com.github.deano2390:MaterialShowcaseView:1.0.6'
}
and I keep getting : Error:(27, 13) Failed to resolve: com.github.deano2390:MaterialShowcaseView:1.0.6
without any additional information.
I've also tried with a sffuix as advised by the library's auther:
compile 'com.github.deano2390:MaterialShowcaseView:1.0.6@aar'
回答1:
Add your repository in app/build.gradle like below
apply plugin: 'com.android.application'
repositories {
maven {
url "https://jitpack.io"
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.domain.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile files('libs/Parse-1.9.1/Parse-1.9.1.jar')
compile files('libs/Parse-1.9.1/bolts-android-1.2.0.jar')
compile 'com.github.deano2390:MaterialShowcaseView:1.0.6'
}
回答2:
Everything looks correct in your Gradle files. Your gradle plugin must not be picking up the JitPack repository for some reason.
See if you can resolve the JitPack test library:
compile 'com.github.jitpack:android-example:1.0.4'
If this cannot be resolved then it must be a configuration issue with your IDE / Gradle plugin / Machine.
回答3:
I had the same problem until I update and reconfigure my IDE and my JDK version (to jdk 8, you can set it on build options)
Then I followed the basic instructions (add JitPack repo in build.gradle on allprojects and the lib)
Also ensure that your min SDK doesn't be smaller than the declared in the lib
回答4:
I have a library project which depends on a library served from jitpack. In my case, adding the following to my library's build.gradle
resolved the issue:
allprojects { p ->
p.repositories {
maven { url "https://jitpack.io" }
}
}
回答5:
Make sure add maven { url "https://jitpack.io" } as the first respository. I am using android studio 3.3 and have the same issue. for some reason libraries in jitpack are fetched from google and jcenter and cant locate it. re-order the repos fix this for me hope its helpful to someone
allprojects {
repositories {
maven { url "https://jitpack.io" }
google()
jcenter()
}
}
来源:https://stackoverflow.com/questions/35983298/jitpack-io-failure-to-resolve