我无法相信没有人知道如何解决这个问题。我想在我的应用程序中添加一个横幅,但Android Studio的Gradle系统试图让我感到高兴,这不是一个好主意。它看起来像这样:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.(package).(name)"
minSdkVersion 15
targetSdkVersion 21
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:21.0.3'
compile 'com.google.android.gms:play-services:7.0.0'
}
日志:
Error:A problem occurred configuring project ':app'.
无法解析配置':app:_debugCompile'的所有依赖项。 找不到com.android.support:support-v4:22.0.0。 在以下位置搜索: https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/ C:/ Program Files(x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/ C:/ Program Files(x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/ C:/ Program Files(x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/ C:/ Program Files(x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar 要求: FakeCall:app:未指定> com.android.support:appcompat-v7:21.0.3 找不到com.android.support:support-v4:22.0.0。 在以下位置搜索: https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/ C:/ Program Files(x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/ C:/ Program Files(x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/ C:/ Program Files(x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/ C:/ Program Files(x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar 要求: FakeCall:app:未指定> com.google.android.gms:play-services:7.0.0> com.google.android.gms:播放服务基:7.0.0
答案 0 :(得分:7)
通过SDK Manager,您需要确保Android Support Repository
是最新的 - 这是解决Android支持库依赖关系的地方。
答案 1 :(得分:2)
添加
compile 'com.android.support:support-v4:22.0.0'