Gradle无法解析':app @ debug / compileClasspath'的依赖关系:

时间:2017-11-03 15:43:04

标签: android gradle android-gradle

根据GitHub上的文档,我的build.gradle(app)是:

repositories {
    jcenter()
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.dubsmash.volley:library:2.0.1'
    compile 'ca.mimic:oauth2library:2.3.0'
    compile 'com.github.kittinunf.fuel:fuel:<latest-version>' //for JVM
    compile 'com.github.kittinunf.fuel:fuel-android:<latest-version>' //for Android
    compile 'com.github.kittinunf.fuel:fuel-livedata:<latest-version>' //for LiveData support
    compile 'com.github.kittinunf.fuel:fuel-rxjava:<latest-version>' //for RxJava support
    compile 'com.github.kittinunf.fuel:fuel-gson:<latest-version>' //for Gson support
    compile 'com.github.kittinunf.fuel:fuel-jackson:<latest-version>' //for Jackson support
}

当我尝试构建Gradle时,会为所有燃料组件抛出以下错误:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.kittinunf.fuel:fuel-livedata:<latest-version>.

Could not resolve com.github.kittinunf.fuel:fuel-livedata:<latest-version>.
Required by:
    project :app
 > No cached version of com.github.kittinunf.fuel:fuel-livedata:<latest-version> available for offline mode.

1 个答案:

答案 0 :(得分:5)

您实际上无法在gradle编译块中编写"<latest-version>"

您必须将其替换为版本号。

所以它类似于:

compile 'com.github.kittinunf.fuel:fuel:2.2.0'

再次,将版本号替换为您想要的版本。