简体   繁体   English

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

[英]Travis-CI implementation of Android SDK 25 with Emulator

I need help with implementing Travis-CI in my android repository. 我需要在Android信息库中实施Travis-CI的帮助。

My Project is compiled with SDK 25 but is downwards compatible to Version 21. 我的项目使用SDK 25进行编译,但向下兼容版本21。

How do I have to change my .travis.yml to run an android emulator thats compatible with that SDK Version? 如何更改我的.travis.yml以运行与该SDK版本兼容的android仿真器?

.travis.yml: .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

Right now it exits with the "no connected devices"-Error, which makes sense, because there is no emulator running. 现在,它退出并显示“没有连接的设备”-错误,这是有道理的,因为没有运行模拟器。 But when I tried it using the android-22 emulator it also crashed with an error like "Android SDK 22 not installed" 但是,当我使用android-22模拟器尝试它时,它也崩溃了,并显示类似“未安装Android SDK 22”的错误

EDIT: The commented lines in the travis.yml didn't work, that's why they are commented out. 编辑: travis.yml中的注释行不起作用,这就是为什么它们被注释掉的原因。

For such properties that we have in our project: 对于项目中具有的这些属性:

compileSdkVersion 25
minSdkVersion 21
targetSdkVersion 25

We use such emulator: 我们使用这样的模拟器:

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

No special deps are required in travis.yml besides: travis.yml不需要特殊的部门,除了:

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

Here is out repository with min SDK 19: https://github.com/elpassion/el-peon-android 这是带有最小SDK 19的存储库: https : //github.com/elpassion/el-peon-android

I only answer the android-22 part because I'm not using Travis-ci with recent versions of Android: 我只回答android-22部分,因为我没有在最新版本的Android中使用Travis-ci:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM