Android 如何使gradle命令行生成从干净的生成安装multidex?
我在尝试从一个干净的版本(用于Jenkins CI)构建Android项目的命令行时遇到了问题。如果我在Android Studio中打开项目并运行带有Gradle文件的Android 如何使gradle命令行生成从干净的生成安装multidex?,android,command-line,gradle,android-multidex,Android,Command Line,Gradle,Android Multidex,我在尝试从一个干净的版本(用于Jenkins CI)构建Android项目的命令行时遇到了问题。如果我在Android Studio中打开项目并运行带有Gradle文件的Tools>Android>Sync项目,我随后可以从命令行进行构建。但是,如果我尝试从命令行运行/gradlew build,而没有首先在Android Studio中打开项目,我会收到以下生成失败: FAILURE: Build failed with an exception. * What went wrong: A
Tools>Android>Sync项目
,我随后可以从命令行进行构建。但是,如果我尝试从命令行运行/gradlew build
,而没有首先在Android Studio中打开项目,我会收到以下生成失败:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':Redacted'.
> Could not resolve all dependencies for configuration ':Redacted:_debugCompile'.
> Could not find com.android.support:multidex:1.0.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/multidex/1.0.0/multidex-1.0.0.pom
https://repo1.maven.org/maven2/com/android/support/multidex/1.0.0/multidex-1.0.0.jar
https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex-1.0.0.pom
https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex-1.0.0.jar
http://download.crashlytics.com/maven/com/android/support/multidex/1.0.0/multidex-1.0.0.pom
http://download.crashlytics.com/maven/com/android/support/multidex/1.0.0/multidex-1.0.0.jar
Required by:
RedactedAndroid:Redacted:unspecified
> Could not find any version that matches com.android.support:support-v4:21.0.+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v4/
https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml
https://jcenter.bintray.com/com/android/support/support-v4/
http://download.crashlytics.com/maven/com/android/support/support-v4/maven-metadata.xml
http://download.crashlytics.com/maven/com/android/support/support-v4/
Required by:
RedactedAndroid:Redacted:unspecified
> Could not find any version that matches com.android.support:appcompat-v7:21.0.+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/
https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml
https://jcenter.bintray.com/com/android/support/appcompat-v7/
http://download.crashlytics.com/maven/com/android/support/appcompat-v7/maven-metadata.xml
http://download.crashlytics.com/maven/com/android/support/appcompat-v7/
Required by:
RedactedAndroid:Redacted:unspecified
> Could not find any version that matches com.google.android.gms:play-services:6.5+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/google/android/gms/play-services/maven-metadata.xml
https://repo1.maven.org/maven2/com/google/android/gms/play-services/
https://jcenter.bintray.com/com/google/android/gms/play-services/maven-metadata.xml
https://jcenter.bintray.com/com/google/android/gms/play-services/
http://download.crashlytics.com/maven/com/google/android/gms/play-services/maven-metadata.xml
http://download.crashlytics.com/maven/com/google/android/gms/play-services/
Required by:
RedactedAndroid:Redacted:unspecified
> Could not find any version that matches com.android.support:support-v4:[21,22).
Required by:
RedactedAndroid:Redacted:unspecified > com.facebook.android:facebook-android-sdk:3.22.0
> Could not find any version that matches com.android.support:appcompat-v7:21.+.
Required by:
RedactedAndroid:Redacted:unspecified > com.uservoice:uservoice-android-sdk:1.2.2
> Could not find com.android.support:support-v4:21..
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/21./support-v4-21..pom
https://repo1.maven.org/maven2/com/android/support/support-v4/21./support-v4-21..jar
https://jcenter.bintray.com/com/android/support/support-v4/21./support-v4-21..pom
https://jcenter.bintray.com/com/android/support/support-v4/21./support-v4-21..jar
http://download.crashlytics.com/maven/com/android/support/support-v4/21./support-v4-21..pom
http://download.crashlytics.com/maven/com/android/support/support-v4/21./support-v4-21..jar
Required by:
RedactedAndroid:Redacted:unspecified > com.uservoice:uservoice-android-sdk:1.2.2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
据我所知,我拥有Gradle脚本中指定的所有适当依赖项:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
和我的应用程序级Gradle脚本:
...
dependencies {
...
compile 'com.android.support:multidex:1.0.0'
...
}
android {
...
另外,.gitignore的某些内容:
# Android Studio and Gradle
build/
local.properties
.gradle
gradle-app.setting
*.iml
.idea/
*.ipr
*.iws
out/
.idea_modules/
为什么不能从干净的命令行版本中找到multidex?我如何解决这个问题?Android Studio和我的命令行版本使用不同的Android SDK安装。我在命令行上使用的那一个没有安装一些必需的附加软件包。一旦我安装了它们,构建工作正常