Travis-CI Android SDK 25 与模拟器的实现

Travis-CI implementation of Android SDK 25 with Emulator

我需要帮助在我的 android 存储库中实施 Travis-CI。

我的项目是用 SDK 25 编译的,但向下兼容版本 21。

如何将我的 .travis.yml 更改为 运行 与该 SDK 版本兼容的 android 模拟器?

.travis.yml:

language: android
jdk: oraclejdk8
android:
  components:
    - tools # to get the new `repository-11.xml`
    - tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
    - platform-tools
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository
    - addon-google_apis-google-19
    - build-tools-25.0.0
    - android-25

  #  - sys-img-armeabi-v7a-android-22

before_script:
    #- android update sdk -a --no-ui --filter sys-img-armeabi-v7a-android-25,sys-img-x86_64-android-25
    # - 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 &

script:
    # - ./gradlew build connectedCheck

现在它以 "no connected devices"-Error 退出,这是有道理的,因为没有模拟器 运行ning。但是当我使用 android-22 模拟器尝试它时,它也崩溃并出现 "Android SDK 22 not installed"

之类的错误

编辑: travis.yml 中的注释行不起作用,这就是它们被注释掉的原因。

对于我们项目中的此类属性:

compileSdkVersion 25
minSdkVersion 21
targetSdkVersion 25

我们使用这样的模拟器:

echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a --skin 480x800

travis.yml 不需要特殊部门,此外:

- tools
- platform-tools
- build-tools-25.0.1
- android-25
- extra-android-m2repository

这是最小 SDK 19 的存储库: https://github.com/elpassion/el-peon-android

我只回答 android-22 部分,因为我没有将 Travis-ci 与最新版本的 Android:

一起使用
language: android
jdk: oraclejdk8
android:
  components:
    - tools # to get the new `repository-11.xml`
    - tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
    - platform-tools
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository
    - build-tools-25.0.0
    - android-25
    - android-22 # Android platform used by your alternative emulator
    - sys-img-armeabi-v7a-android-22

before_script:
    - 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 &

script:
    - ./gradlew build connectedCheck