クリーン ビルド (Jenkins CI 用) から Android プロジェクトのコマンド ライン ビルドを実行しようとすると問題が発生します。Android Studio でプロジェクトを開いて を実行するTools > Android > Sync Project with Gradle Files
と、その後コマンドラインからビルドできます。ただし、./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 が見つからないのはなぜですか? この問題を解決するにはどうすればよいですか?