簡體   English   中英

Travis-CI Build error android app

[英]Travis-CI Build error android app

我正在嘗試使用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版本:
https://travis-ci.org/Luuk2016/WeatherApp-Android/jobs/371162957

和我的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。

licenses:
  - '.+'

編輯:

由於您的構建現在由於錯誤“未連接的設備”而失敗。 您必須在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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM