Travis模拟器在android-wait-for-emulator之后停止

fli*_*r83 2 android android-emulator travis-ci

嗨,我有下一个 travis 配置:

语言:安卓

env:
  global:
  - JAVA8_HOME=/usr/lib/jvm/java-8-oracle
  - TERM=dumb

jdk:
  - oraclejdk8

android:
  components:
   - platform-tools
   - tools
   - build-tools-23.0.1
   - build-tools-22.0.1
   - android-23
   - android-22
   - extra
   - extra-android-support
   - extra-google-google_play_services
   - extra-google-m2repository
   - extra-android-m2repository
   - addon-google_apis-google-23
   - addon-google_apis-google-22

before_script:
  - echo no | android create avd --force --name test --target android-21 --abi armeabi-v7a
  - emulator -avd test -no-skin -no-audio -no-window -gpu off -no-boot-anim &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

script:
  - ./gradlew :projectcore:checkstyle
  - ./gradlew clean build -x lint
  - ./gradlew :project:connectedAndroidTest
Run Code Online (Sandbox Code Playgroud)

好的,如果我运行这个,下载所有依赖项,但是当运行模拟器时停止它。

emulator -avd test -no-skin -no-audio -no-window -gpu off -no-boot-anim &
$ android-wait-for-emulator
Creating filesystem with parameters:
    Size: 69206016
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 4224
    Inode size: 256
    Journal blocks: 1024
    Label: 
    Blocks: 16896
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
Failed to Initialize backend EGL display
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Run Code Online (Sandbox Code Playgroud)

我不知道这是什么问题:S,有人对这个问题有任何线索吗?如果我删除 android-wait-for-emulator 继续执行但测试失败,因为模拟器尚未连接(有道理)。想法?

fli*_*r83 5

我发现了问题:尝试安装时platform-tools,Travis 无法移动文件夹,因为文件夹存在并删除了文件夹内容,这个文件夹是platforms-tools,其中包含adb命令,这解释了为什么android-wait-for-emulator失败。

解决方案是从components部分中删除- platform-tools和,因为默认情况下已经提供了。- tools

修复这个问题很困难,我相信这对任何人都有用。

  • 但是,官方文档建议添加现有组件-`我们建议您明确指定项目所需的组件`:https://docs.travis-ci.com/user/languages/android/ (2认同)