【发布时间】:2018-10-15 19:47:12
【问题描述】:
我尝试将 android volley 导入我的项目,但失败了。我不知道发生了什么。这是 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.root.wifi1"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.volley:volley:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
这是项目的 build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
//maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我尝试过使用 volley library 版本 1.1.1、1.1.0、mcxiaoke 的版本以及其他几个版本,但都没有工作。我还尝试切换我的 gradle 版本,并尝试使用我克隆的 android volley 创建本地库。有人建议将maven { url "https://jitpack.io" } 添加到所有项目存储库中,我也尝试过,但也没有用。当然,我也尝试过从设置菜单中禁用离线 gradle,但它并没有改变任何东西。
这是错误:
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.1.
每次我更改凌空版本时,错误也是如此。 我现在不知道该怎么办,请帮忙
PS:如果我评论/删除 volley 依赖项,我的项目可以 100% 正常工作,而且我不使用受代理保护的互联网
【问题讨论】:
标签: android dependencies android-volley