Unable to build a project using Travis-CI and Android

I tried in the last 2 days to create CI using travis and android.

The problem is that I fix the problem, another one appears

I am looking on the stack for anwser but no one is fixing my problem

You have not accepted the license agreements for the following SDK components: [Com.android.support.constraint: layout-constraint: 1.0.0-alpha-4, com.android.support.constraint: layout-solver-constraint: 1.0.0-alpha 4].

My root build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0-beta1'

        //Dagger 2 dependency
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

        //Realm Dependecies
        classpath "io.realm:realm-gradle-plugin:1.1.1"
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

//Realm Dependecies
apply plugin: 'realm-android'

android {
    signingConfigs {
    }
    compileSdkVersion 24
    buildToolsVersion "24.0.1"
    dataBinding {
        enabled = true
    }

    defaultConfig {
        applicationId "rhcloud.com.financialcontrol"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    androidTestCompile('com.android.support.test:runner:0.5', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestCompile('com.android.support.test:rules:0.5', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'

    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.android.support:design:24.1.1'


    //Dagger 2 dependencies
    apt 'com.google.dagger:dagger-compiler:2.0'
    compile 'com.google.dagger:dagger:2.0'
    provided 'javax.annotation:jsr250-api:1.0'

    compile 'klauswk:DroidUtils:0.1-ALPHA'

}

.travis.yml

    android: 
  components: 
    - tools
    - platform-tools
    - build-tools-24.0.1
    - android-24
    - extra-android-m2repository
    - extra-android-support
    - sys-img-armeabi-v7a-android-22
    - extra-google-google_play_services
  licenses: 
    - android-sdk-preview-license-52d11cd2
    - android-sdk-license-.+
    - google-gdk-license-.+
before-script: 
  - "android update sdk --no-ui --filter build-tools-24.0.1,android-24,extra-android-m2repository"
  - "echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a"
  - "emulator -avd test -no-skin -no-audio -no-window &"
  - android-wait-for-emulator
  - "adb shell input keyevent 82 &"
before_cache: 
  - "rm -f $HOME/.gradle/caches/modules-2/modules-2.lock"
before_install: 
  - "chmod +x gradlew"
cache: 
  directories: 
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
env: 
  matrix: 
    - "ANDROID_TARGET=android-22  ANDROID_ABI=armeabi-v7a"
jdk: oraclejdk8
language: android
script: 
  - "./gradlew build connectedCheck --stacktrace"

Any help would be appreciated, source code can be found here.

EDITED

I finally managed to get it to work.

First, in order to fix the license problem, I will lower the value of buildtools and compile to 23 and add 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'as a dependency.

, , travis.yml.

, android-sdk-license-c81a61d9, .

+4
1

:

before-script: before_script:

.

:

"ARM EABI v7a System Image, Android API 22, 1"; "SDK Platform Android 5.1.1, API 22, 2", .

, , android-22.

android: 
  components: 
    - tools
    - ...
    - android-22
    - sys-img-armeabi-v7a-android-22
    - ...

Android-23:

com.android.builder.testing.api.DeviceException: !

+3

Source: https://habr.com/ru/post/1650761/


All Articles