在Android Studio 3.1.2中添加Volley的问题

时间:2018-05-01 12:38:37

标签: android android-studio gradle android-volley

我想在Android Studio 3.1.2中为我的项目添加Volley。我正在尝试使用implementation 'com.android.volley:volley:1.1.0'

这是项目的Gradle:

buildscript {
    ext.kotlin_version = '1.2.41'
    repositories {
         google()
         jcenter()
    }
    dependencies {
         classpath 'com.android.tools.build:gradle:3.1.2'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
        mavenCentral()
        maven {
            url "https://maven.google.com"
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

但它失败并出现以下错误:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
Open File
Show Details


Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
Open File
Show Details


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
Open File
Show Details


Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
Open File
Show Details


Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
Open File
Show Details

这是错误的形象,希望能更好地理解问题。 enter image description here

我在这里缺少什么?

2 个答案:

答案 0 :(得分:0)

事实证明,Invalidate Caches / Restart做了伎俩!

答案 1 :(得分:0)

将其替换为implementation 'com.android.volley:volley:1.1.1'

这肯定会解决问题。