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?
My .travis.yml
is this:
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
My build.gradle
is:
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'
}
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
Any idea how to fix this? Is it even possible to build ConstraintLayout
with Travis?
After the new release of the Support Library version 25.0.0, the Constraint Layout Alpha1 library apparently doesn't work anymore on TravisCI. Using that version was the only workaround at the moment.
Now I found a new workaround to use the new Alpha9 version. In your .travis.yml
file add:
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
Do not forgot to accept all the licences on the main android
object:
licenses:
- android-sdk-license-.+
- '.+'