无法使用Travis-CI和Android构建项目

克劳斯·克莱因

在过去的两天里,我一直在尝试使用travis和android构建CI。

问题是,无论我如何解决问题,都会出现另一个问题

我在堆栈中搜索anwser,但没有一个能解决我的问题

您尚未接受以下SDK组件的许可协议:[com.android.support.constraint:constraint-layout:1.0.0-alpha4,com.android.support.constraint:constraint-layout-solver:1.0.0- alpha4]。

我的根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
}

应用程序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"

任何帮助将不胜感激,源代码可以在这里找到

已编辑

我终于设法使它起作用。

首先,为了解决许可证问题,我将构建工具降级并编译为23,然后将其添加'com.android.support.constraint:constraint-layout:1.0.0-alpha1'为依赖项。

另外,通过Ardock的解决方案,我设法在travis.yml中发现错误。

最后,我添加了android-sdk-license-c81a61d9自动接受许可证。

工作提交可以在这里找到

阿尔贝德鲁

编辑:

替换before-script:before_script:

否则不执行该块。

先前的回应:

看到这条线

跳过“ ARM EABI v7a系统映像,Android API 22,修订版1”;它取决于未安装的“ SDK平台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:没有连接的设备!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Cache Brew使用travis ci构建

travis.ci上的Android构建变体

Travis CI跳过测试(Gradle Android项目)

Travis CI-Android项目构建失败

使用travis在CentOS上构建项目?

Travis CI for Android-构建错误:无法找到目标并且无法找到依赖项

Xcodebuild- Travis CI是否由于代码签名错误而无法归档使用cocoapods的项目?

在Android上使用Travis CI

项目在本地构建,但在travis-ci容器中失败

在Travis-CI上使用Swift 3和Cocoapods构建项目时出现“错误:意外动作:构建”

在Travis CI中构建多模块Gradle项目

我无法使用travis.CI构建android-27,tool-27.0.2

Travis CI构建PHP项目并从Composer提取依赖项,尝试使用git @而不是https

Travis CI-Android构建脚本

Android-Travis CI。无法使用travis login --pro命令登录

Travis CI为什么无法构建Python项目?

Jenkins和Gradle-使用CI的最新依赖版本,生产的特定版本构建项目

由于PySide2和Matplotlib,Travis-CI无法构建

无法使用cmd构建android项目

Travis CI无法解析.travis.yml

无法使用Android Studio构建项目

无法使用android-ndk和Android Studio构建项目

如何使用Travis CI和Scalr部署成功的构建

如何使用Gradle和Cobertura在travis-ci上构建

为什么我的组织无法在travis-ci上使用?

Travis CI无法使用** / * _ test.rb模式运行测试

无法在 Travis CI 中使用 Java 运行 exec("cwebp ...")

使用新的 Flutter 项目构建 Travis-CI 的问题

使用 tikz 环境时,Travis CI 无法用于预订