0
我在嘗試一件簡單的事情:導入一些Google的庫以便使用Gmail API。我知道mavenCentral上不存在這些罐中的一些。因此,我從sdk管理器更新了我的Google知識庫,並指示gradle查看sdk。我還刪除了依賴關係末尾的版本號,並用一個+替換了它們,這並不能解決我的問題,因此會回退到originalbuild.gradle
文件。Gradle無法解決所有依賴關係
我build.gradle
文件看起來像這樣:
buildscript {
repositories {
mavenCentral()
def androidHome = System.getenv("ANDROID_HOME")
maven {
url "$androidHome/extras/android/m2repository/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.hellobusiness.hotels"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.google.api-client:google-api-client:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.20.0'
compile 'com.google.apis:google-api-services-gmail:v1-rev29-1.20.0'
}
的錯誤,我得到:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'Hotels'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.google.api-client:google-api-client:1.20.0.
Searched in the following locations:
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/api-client/google-api-client/1.20.0/google-api-client-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/api-client/google-api-client/1.20.0/google-api-client-1.20.0.jar
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/api-client/google-api-client/1.20.0/google-api-client-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/api-client/google-api-client/1.20.0/google-api-client-1.20.0.jar
Required by:
:Hotels:unspecified
> Could not find com.google.api-client:google-api-client-android:1.20.0.
Searched in the following locations:
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/api-client/google-api-client-android/1.20.0/google-api-client-android-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/api-client/google-api-client-android/1.20.0/google-api-client-android-1.20.0.jar
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/api-client/google-api-client-android/1.20.0/google-api-client-android-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/api-client/google-api-client-android/1.20.0/google-api-client-android-1.20.0.jar
Required by:
:Hotels:unspecified
> Could not find com.google.api-client:google-api-client-gson:1.20.0.
Searched in the following locations:
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/api-client/google-api-client-gson/1.20.0/google-api-client-gson-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/api-client/google-api-client-gson/1.20.0/google-api-client-gson-1.20.0.jar
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/api-client/google-api-client-gson/1.20.0/google-api-client-gson-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/api-client/google-api-client-gson/1.20.0/google-api-client-gson-1.20.0.jar
Required by:
:Hotels:unspecified
> Could not find com.google.apis:google-api-services-gmail:v1-rev29-1.20.0.
Searched in the following locations:
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/apis/google-api-services-gmail/v1-rev29-1.20.0/google-api-services-gmail-v1-rev29-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/android/m2repository/com/google/apis/google-api-services-gmail/v1-rev29-1.20.0/google-api-services-gmail-v1-rev29-1.20.0.jar
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/apis/google-api-services-gmail/v1-rev29-1.20.0/google-api-services-gmail-v1-rev29-1.20.0.pom
file:/home/sanctus/adt/sdk/extras/google/m2repository/com/google/apis/google-api-services-gmail/v1-rev29-1.20.0/google-api-services-gmail-v1-rev29-1.20.0.jar
Required by:
:Hotels:unspecified
我與ADT插件使用Eclipse,我使用gradle這個命令行
更新此類路徑「com.android.tools 。build:gradle:0.14。+' –
請註釋compile'com.google.api-client:google-api-client-android:1.20.0'this並檢查其效果 –
我更新了您所選擇的類路徑,並且我收到了一條消息,提示我從gradle 2.1升級到2.2。我這樣做,並重新建立。編輯:我被卡住「解決依賴關係」爲10分鐘... –