找不到 'com.firebase:firebase-jobdispatcher'
Could not find 'com.firebase:firebase-jobdispatcher'
我正在尝试将 Firebase Job Dispatcher 添加到我的项目中,但由于出现此错误而无法构建:
Gradle sync failed: Could not find
com.firebase:firebase-jobdispatcher:[version]. Required by: project
:[module]
我的 build.gradle
文件如下所示:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
zipAlignEnabled true
}
}
}
repositories {
mavenCentral()
maven {url "https://clojars.org/repo/"}
}
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v13:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/volley.jar')
}
此外,我通过 SDK 管理器安装了 Google 存储库版本 45 和 Google Play 服务版本 39。
根据 documentation on the firebase-jobdispatcher Github page,这应该是我唯一需要添加依赖项的东西。我的项目不依赖 GCM,所以我不确定发生了什么。我在这里遗漏了什么吗?
显然,Gradle 无法单独使用 Maven Central 解决依赖关系。将 JCenter 添加到我的存储库列表中解决了这个问题:
repositories {
jcenter() // new
mavenCentral()
maven {url "https://clojars.org/repo/"}
}
我正在尝试将 Firebase Job Dispatcher 添加到我的项目中,但由于出现此错误而无法构建:
Gradle sync failed: Could not find com.firebase:firebase-jobdispatcher:[version]. Required by: project :[module]
我的 build.gradle
文件如下所示:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
zipAlignEnabled true
}
}
}
repositories {
mavenCentral()
maven {url "https://clojars.org/repo/"}
}
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v13:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/volley.jar')
}
此外,我通过 SDK 管理器安装了 Google 存储库版本 45 和 Google Play 服务版本 39。
根据 documentation on the firebase-jobdispatcher Github page,这应该是我唯一需要添加依赖项的东西。我的项目不依赖 GCM,所以我不确定发生了什么。我在这里遗漏了什么吗?
显然,Gradle 无法单独使用 Maven Central 解决依赖关系。将 JCenter 添加到我的存储库列表中解决了这个问题:
repositories {
jcenter() // new
mavenCentral()
maven {url "https://clojars.org/repo/"}
}