1
由於某些原因,gradle無法解決我的任何依賴關係。這是一個例子:Gradle無法解決我的任何依賴關係
模塊:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "app.simplelogin"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
testCompile 'junit:junit:4.12'
}
項目:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
當我嘗試同步或構建,我得到以下錯誤:
Failed to resolve: com.squareup.okhttp3:okhttp:3.0.1
我得到這個相同錯誤消息與我嘗試添加的每個依賴關係 - 任何人都知道爲什麼?
這是這個的副本,http://stackoverflow.com/questions/34895397/not-able-to-import-com-squareup-okhttp-okhttpclient – aconnelly
@aconnelly:不,它不是。接受的答案是wj1091已經在做什麼。 – CommonsWare
您可以發佈更多關於您列出的消息點的Gradle控制檯輸出嗎?另外,您的網絡是否有不尋常之處(例如,需要使用代理服務器)? – CommonsWare