由于“目标ID无效”,Travis Android构建失败。

时间:2017-12-04 20:54:08

标签: android travis-ci

我想在连接的设备上运行android测试。这是我的.travis.yml文件:

language: android
jdk: oraclejdk8

env:
  global:
   - ADB_INSTALL_TIMEOUT=10

before_cache:
  - cd ${TRAVIS_BUILD_DIR}/gradle/caches/
  - find . -name "*.lock" -exec rm -rfv {} \;
  - cd ${TRAVIS_BUILD_DIR}

cache:
  directories:
    - ${TRAVIS_BUILD_DIR}/gradle/caches/
    - ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/

notifications:
  email: false

android:
  components:
    - tools
    - build-tools-25.0.2
    - platform-tools
    - tools
    - sys-img-armeabi-v7a-android-22

install:
  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
  # Show version and download Gradle Wrapper if it's not already cached
  - ./gradlew --version
  # Check components status
  - sdkmanager --list || true

  # Emulator Management: Create, Start and Wait
before_script:
  - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
  - emulator -avd test -no-audio -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

script:
  - android list target
  - ./gradlew build connectedCheck test jacocoTestReport

after_script:
  # Show lint results
  - cat ${TRAVIS_BUILD_DIR}/*/build/reports/lint-results.xml

after_success:
- bash <(curl -s https://codecov.io/bash)

以下是构建日志https://travis-ci.org/mueller-ma-bot/openhab.android/builds/311512604?utm_source=github_status&utm_medium=notification

1 个答案:

答案 0 :(得分:0)

检查构建日志中的this line

  

跳过&#39; ARM EABI v7a系统映像,Android API 22,修订版2&#39;它   取决于SDK平台Android 5.1.1,API 22,修订版2&#39;这是   没安装。

安装缺少的平台:

android:
  components:
    - tools
    - build-tools-25.0.2
    - platform-tools
    - tools
    - android-22
    - sys-img-armeabi-v7a-android-22