我正在使用控制台中的gradlew命令编译项目,我收到此错误:
BUILD FAILED
Total time: 16.775 secs
Err:
Err:FAILURE: Build failed with an exception.
Err:
Err:* What went wrong:
Err:A problem occurred configuring project ':capLibrary'.
Err:> Could not resolve all dependencies for configuration ':capLibrary:_debugCompile'.
Err: > Could not find com.android.support:support-v4:22.2.1.
Err: Searched in the following locations:
Err: https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
Err: https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
Err: Required by:
Err: CapAndroid:capLibrary:unspecified
Err: > Could not find com.google.android.gms:play-services:7.5.0.
Err: Searched in the following locations:
Err: https://jcenter.bintray.com/com/google/android/gms/play-services/7.5.0/play-services-7.5.0.pom
Err: https://jcenter.bintray.com/com/google/android/gms/play-services/7.5.0/play-services-7.5.0.jar
Err: Required by:
Err: CapAndroid:capLibrary:unspecified
我不知道出了什么问题,这些是我的gradle依赖项:
对于应用程序模块:
dependencies {
compile project(':capLibrary')
compile 'com.google.android.gms:play-services:7.5.0'
}
对于库模块(capLibrary
):
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
这是库(capLibrary
)的完整gradle.build文件:
apply plugin: 'com.android.library'
android {
compileSdkVersion 'Google Inc.:Google APIs:22'
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 10
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
这是应用程序模块的完整gradle.build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:22'
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.launcher"
minSdkVersion 10
targetSdkVersion 10
}
signingConfigs {
release {
storeFile file("dummy")
storePassword "dummy"
keyAlias "dummy"
keyPassword "dummy"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile project(':capLibrary')
compile 'com.google.android.gms:play-services:7.5.0'
}
答案 0 :(得分:1)
运行Android SDK Manager。
提示:在控制台写入>> android [enter]
从Android SDK Manager / Extras安装:
答案 1 :(得分:0)
找不到com.android.support:support-v4:22.2.1。 找不到com.google.android.gms:play-services:7.5.0。
库项目找不到这些支持库。
请检查一下。看看这是否有帮助。
转到项目结构,从模块中选择capLibrary模块。检查其依赖项。如果不存在,请添加v4支持并播放服务和构建项目。