使用 Gradle 控制台命令的问题 (gradlew)
Problems using Gradle console command (gradlew)
我正在控制台中使用 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'
}
运行 Android SDK 管理器。
tip: in console write >> android [enter]
并从 Android SDK Manager / Extras 安装:
- Android 支持存储库
- Google 存储库
无法找到 com.android.support:support-v4:22.2.1。
找不到 com.google.android.gms:play-services:7.5.0.
库项目找不到这些支持库。
请检查这个。看看这是否有帮助。
转到项目结构,然后从模块 select 您的 capLibrary 模块。检查它的依赖关系。如果不存在,请添加 v4 支持并播放服务并构建项目。
我正在控制台中使用 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'
}
运行 Android SDK 管理器。
tip: in console write >> android [enter]
并从 Android SDK Manager / Extras 安装:
- Android 支持存储库
- Google 存储库
无法找到 com.android.support:support-v4:22.2.1。 找不到 com.google.android.gms:play-services:7.5.0.
库项目找不到这些支持库。
请检查这个。看看这是否有帮助。
转到项目结构,然后从模块 select 您的 capLibrary 模块。检查它的依赖关系。如果不存在,请添加 v4 支持并播放服务并构建项目。