我使用Gitlab CI进行持续集成。每次提交后,我在管道中有3个工作:debug,unitTests和instrumentedTests。但是现在,由于超时,仪器化测试失败了。我在下面添加了gitlab-ci.yml文件
我已经尝试过降级android sdk版本,但是根本没有运气。也许有一些针对yml-file的命令可以解决此问题。
也许有人知道如何使EMULATOR_VERSION> 22的所有测试都不会失败。
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.3"
ANDROID_SDK_TOOLS: "4333796" # from https://developer.android.com/studio/#command-tools
EMULATOR_VERSION: "22"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
stages:
- build
- test
assembleDebug:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
unitTests:
stage: test
script:
- ./gradlew test
instrumentedTests:
stage: test
script:
- wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
- chmod +x android-wait-for-emulator
- android-sdk-linux/tools/bin/sdkmanager --update > update.log
- android-sdk-linux/tools/bin/sdkmanager "platform-tools" "emulator" "system-images;android-${EMULATOR_VERSION};default;armeabi-v7a" > installEmulator.log
- echo no | android-sdk-linux/tools/bin/avdmanager create avd -n test -k "system-images;android-${EMULATOR_VERSION};default;armeabi-v7a"
- android-sdk-linux/emulator/emulator -avd test -no-window -no-audio &
- ./android-wait-for-emulator
- adb shell input keyevent 82
- ./gradlew connectedCheck
答案 0 :(得分:0)
有以下因素:
虽然不再支持qemu了,但是这个悬而未决的具体错误似乎永远不会得到解决。
要切换到ranchu环境:
*default*
平台用于avd,最好使用*google-api*
的平台(而在默认平台上缺少ranchu内核)以防万一它对我有所帮助。