Travis CI构建不适用于Android约束布局 [英] Travis CI build doesn't work with Android Constraint Layout
问题描述
我正在尝试让Travis构建我的Android项目.尝试下载ConstraintLayout
的库时失败.您知道我必须做什么才能使其正常工作吗?
I am trying to make Travis build my Android project. It fails when it tries to download the library for ConstraintLayout
. Do you know what I have to do to make it work?
我的.travis.yml
是这样的:
language: android
jdk:
- oraclejdk8
android:
components:
- platform-tools
- tools
- build-tools-23.0.2
- android-23
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository
我的build.gradle
是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.example.bdd"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha2'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
}
我在Travis上遇到的错误是:
And the error I get on Travis is:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha2.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/constraint/constraint-layout/1.0.0-alpha2/constraint-layout-1.0.0-alpha2.pom
https://jcenter.bintray.com/com/android/support/constraint/constraint-layout/1.0.0-alpha2/constraint-layout-1.0.0-alpha2.jar
file:/usr/local/android-sdk/extras/android/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha2/constraint-layout-1.0.0-alpha2.pom
file:/usr/local/android-sdk/extras/android/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha2/constraint-layout-1.0.0-alpha2.jar
file:/usr/local/android-sdk/extras/google/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha2/constraint-layout-1.0.0-alpha2.pom
file:/usr/local/android-sdk/extras/google/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha2/constraint-layout-1.0.0-alpha2.jar
有什么办法解决这个问题吗?甚至可以用Travis构建ConstraintLayout
吗?
Any idea how to fix this? Is it even possible to build ConstraintLayout
with Travis?
推荐答案
您的build.gradle
试图引入com.android.support.constraint:constraint-layout:1.0.0-alpha2
.我的SDK管理器仅向我提供1.0.0-alpha1
(Android支持存储库的修订版32).也许Travis CI也只有1.0.0-alpha1
.
Your build.gradle
is attempting to pull in com.android.support.constraint:constraint-layout:1.0.0-alpha2
. My SDK Manager only offers me 1.0.0-alpha1
(Rev 32 of the Android Support Repository). Perhaps Travis CI also only has 1.0.0-alpha1
as well.
由于我假设您已经在开发计算机上进行过1.0.0-alpha2
的工作,所以我不确定这里发生了什么. Android支持存储库的分发包装中可能存在故障.
Since I presume that you have 1.0.0-alpha2
working on your development machine, I am not quite certain what is going on here. There might be a glitch in the distribution packaging of the Android Support Repository or something.
这篇关于Travis CI构建不适用于Android约束布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!