Travis CI生成错误android应用程序

Travis CI生成错误android应用程序,android,continuous-integration,travis-ci,Android,Continuous Integration,Travis Ci,我正在尝试使用Travis CI构建我的应用程序 但出于某种原因,它不断地犯下这样的错误: The command "./gradlew build connectedCheck" exited with 1. 这就是我的.travis.yml中的内容: language: android before_install: - chmod +x gradlew android: components: - tools -

我正在尝试使用Travis CI构建我的应用程序
但出于某种原因,它不断地犯下这样的错误:

The command "./gradlew build connectedCheck" exited with 1.
这就是我的.travis.yml中的内容:

    language: android
    before_install:
      - chmod +x gradlew
    android:
     components:
       - tools 
       - platform-tools
       - build-tools-27.1.1
       - android-27

    script:
     - ./gradlew build connectedCheck
这里是我的Travis build的链接:

和我的build.gradle文件:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.district420.weatherapp"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

希望有人能帮助我

您的构建失败,因为您尚未接受Android SDK软件包的许可证。将此行添加到travis.yml

编辑:

因为您的构建现在由于错误“无连接设备”而失败。您必须在travis中创建一个模拟器,并在其上运行检测测试。 在travis.yml文件中也添加这些行

env:
  global:
    - ANDROID_API_LEVEL=27
    - ANDROID_EMULATOR_LEVEL=21
    - ANDROID_BUILD_TOOLS_VERSION=27.0.3
    - ANDROID_ABI=armeabi-v7a
    - ANDROID_TAG=google_apis
    - ADB_INSTALL_TIMEOUT=20
将这些行添加到travis文件的components部分

 - android-$ANDROID_EMULATOR_LEVEL
 - sys-img-armeabi-v7a-google_apis-$ANDROID_EMULATOR_LEVEL
再加上这些行

before_script:
# Create and start emulator.
  - echo no | android create avd --force -n test -t "android-"$ANDROID_EMULATOR_LEVEL --abi $ANDROID_ABI --tag $ANDROID_TAG
  - emulator -avd test -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &
另外,将此添加为travis.yml的第一行

sudo: false

您的生成失败,因为您尚未接受Android SDK包的许可证。将此行添加到travis.yml

编辑:

因为您的构建现在由于错误“无连接设备”而失败。您必须在travis中创建一个模拟器,并在其上运行检测测试。 在travis.yml文件中也添加这些行

env:
  global:
    - ANDROID_API_LEVEL=27
    - ANDROID_EMULATOR_LEVEL=21
    - ANDROID_BUILD_TOOLS_VERSION=27.0.3
    - ANDROID_ABI=armeabi-v7a
    - ANDROID_TAG=google_apis
    - ADB_INSTALL_TIMEOUT=20
将这些行添加到travis文件的components部分

 - android-$ANDROID_EMULATOR_LEVEL
 - sys-img-armeabi-v7a-google_apis-$ANDROID_EMULATOR_LEVEL
再加上这些行

before_script:
# Create and start emulator.
  - echo no | android create avd --force -n test -t "android-"$ANDROID_EMULATOR_LEVEL --abi $ANDROID_ABI --tag $ANDROID_TAG
  - emulator -avd test -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &
另外,将此添加为travis.yml的第一行

sudo: false

我收到以下错误:失败:生成失败,出现异常。*错误:任务执行失败:应用程序:connectedDebugAndroidTest'>com.android.builder.testing.api.DeviceException:没有连接的设备!这是由于另一个错误,因为您没有在travis配置中创建仿真器,并且必须在代码中进行检测测试。您能帮助我创建仿真器吗?或者只是给我代码谢谢,我必须在文件中按特定顺序放置它吗?或者我可以把它全部粘贴到他们的文件夹中吗?我现在明白了:我对订单不是很确定,我想订单应该不重要。但是,作为一种实践,我们的文件类似于.Im,出现以下错误:失败:生成失败,出现异常。*错误:任务执行失败:应用程序:connectedDebugAndroidTest'>com.android.builder.testing.api.DeviceException:没有连接的设备!这是由于另一个错误,因为您没有在travis配置中创建仿真器,并且必须在代码中进行检测测试。您能帮助我创建仿真器吗?或者只是给我代码谢谢,我必须在文件中按特定顺序放置它吗?或者我可以把它全部粘贴到他们的文件夹中吗?我现在明白了:我对订单不是很确定,我想订单应该不重要。然而,作为一种实践,我们有类似的文件。