【问题标题】:Android Volley DependencyAndroid Volley 依赖
【发布时间】:2015-12-10 10:43:54
【问题描述】:

Volley 的依赖项似乎遇到了编译错误,我不知道为什么?这是我的依赖代码和产生的错误消息。

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}

错误:配置项目 ':app' 时出现问题。 >

 Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not resolve com.mcxiaoke.volley:library-aar:1.0.0.
     Required by:
         AndroidHive:app:unspecified
      > Could not resolve com.mcxiaoke.volley:library-aar:1.0.0.
         > Could not get resource 'https://jcenter.bintray.com/com/mcxiaoke/volley/library-aar/1.0.0/library-aar-1.0.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/mcxiaoke/volley/library-aar/1.0.0/library-aar-1.0.0.pom'.
               > peer not authenticated

在尝试了新版本的 Volley 之后,我现在收到了这个编译错误:

Error:(25, 13) Failed to resolve: com.mcxiaoke.volley:library:1.0.7

完整的构建文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.george.androidhive"
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
}

【问题讨论】:

  • 同步 Gradle 时会报错吗?
  • @Sharj 是的,我会再试一次以确保。
  • 检查github.com/mcxiaoke/android-volley 以获得最新版本:compile 'com.mcxiaoke.volley:library:1.0.19' 使用这个。
  • 运行重建时仍然收到“无法解决”错误消息
  • 首先清理您的项目并关闭 Android Studio,然后重试。

标签: java android android-volley


【解决方案1】:

试试这个

compile 'com.mcxiaoke.volley:library:1.0.19'

更新

此项目已被弃用。使用 jCenter 官方版本

compile 'com.android.volley:volley:1.0.0'

【讨论】:

  • 不适合我,对gradle版本/api版本有什么要求吗?
  • @artdias90 它应该可以工作。现在也可以直接使用正式版了。查看更新的答案。
  • 我无法使用更新的依赖项,也无法在库的依赖项列表中找到它。还有什么我需要做的吗?到目前为止,我一直在使用 compile 'com.mcxiaoke.volley:library:1.0.19'。
猜你喜欢
  • 1970-01-01
  • 2018-11-15
  • 2015-05-22
  • 2017-01-06
  • 1970-01-01
  • 1970-01-01
  • 2018-11-08
  • 2021-02-10
  • 1970-01-01
相关资源
最近更新 更多