首页 > 解决方案 > Circle CI 运行 UI 测试但 emulator64 不在 lib64 或 lib64/qt/lib 中

问题描述

在这里,我正在尝试运行 circle ci 来测试 android 应用程序。

这是上传到 GitHub 的配置文件 .yml。

#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
  build:

    working_directory: ~/code

    docker:
      # specify the version you desire here
      - image: circleci/android:api-25

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4

    environment:
      # Customize the JVM maximum heap limit
      JVM_OPTS: -Xmx3200m

    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "WIFIAPLoggingSystem/build.gradle" }}-{{ checksum  "WIFIAPLoggingSystem/app/build.gradle" }}
      - run:
          name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
          command: sudo chmod +x ./WIFIAPLoggingSystem/gradlew
      - run:
          name: Download Dependencies
          working_directory: ~/code/WIFIAPLoggingSystem
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "WIFIAPLoggingSystem/build.gradle" }}-{{ checksum  "WIFIAPLoggingSystem/app/build.gradle" }}

      - run:
          name: Setup emulator
          command: sdkmanager "system-images;android-21;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-21;default;armeabi-v7a"
      - run:
          name: Check Libaray
          command: ls ${ANDROID_HOME}/emulator/lib64
      - run:
          name: Check Libaray
          command: ls ${ANDROID_HOME}/emulator/lib64/qt/lib
      - run:
          name: Launch emulator
          command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
          background: true
      - run:
          name: Run Unit Tests
          working_directory: ~/code/WIFIAPLoggingSystem
          command: ./gradlew test
      - run:
          name: Run Instrument Tests
          working_directory: ~/code/WIFIAPLoggingSystem
          command: ./gradlew connectedAndroidTest
      - store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
          path: WIFIAPLoggingSystem/app/build/reports
          destination: reports
      - store_test_results: # for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
          path: WIFIAPLoggingSystem/app/build/test-results
      # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

ls ${ANDROID_HOME}/emulator/lib64 的结果

#!/bin/bash -eo pipefail
ls ${ANDROID_HOME}/emulator/lib64
emulator-studio-view.jar  libGLES_CM_translator.so  libc++.so.1
gles_mesa         libGLES_V2_translator.so  libemugl_common.so
gles_swiftshader      libOpenglRender.so        libtcmalloc_minimal.so.4
libEGL_translator.so      libandroid-studio.so      qt
libGLES12Translator.so    libc++.so         vulkan

ls ${ANDROID_HOME}/emulator/lib64/qt/lib 的结果

#!/bin/bash -eo pipefail
ls ${ANDROID_HOME}/emulator/lib64/qt/lib
libQt5CoreAndroidEmu.so.5          libX11-xcb.so.1.0
libQt5DBusAndroidEmu.so.5          libX11-xcb.so.1.0.0
libQt5GuiAndroidEmu.so.5           libfontconfig.so.1
libQt5NetworkAndroidEmu.so.5           libfreetype.so.6
libQt5PrintSupportAndroidEmu.so.5      libsoftokn3.so
libQt5QmlAndroidEmu.so.5           libsqlite3.so
libQt5QuickAndroidEmu.so.5         libxcb-xkb.so.1
libQt5QuickWidgetsAndroidEmu.so.5      libxcb-xkb.so.1.0
libQt5SvgAndroidEmu.so.5           libxcb-xkb.so.1.0.0
libQt5WebChannelAndroidEmu.so.5        libxkbcommon-x11.so
libQt5WebEngineCoreAndroidEmu.so.5     libxkbcommon-x11.so.0
libQt5WebEngineWidgetsAndroidEmu.so.5  libxkbcommon-x11.so.0.0.0
libQt5WebSocketsAndroidEmu.so.5        libxkbcommon.so
libQt5WidgetsAndroidEmu.so.5           libxkbcommon.so.0
libQt5XcbQpaAndroidEmu.so.5        libxkbcommon.so.0.0.0
libX11-xcb.so.1

显然 emulator64 不包含在上述任何目录中。

有什么方法可以解决这个问题吗?

设置部分没有问题,但这是启动模拟器时的消息返回。

#!/bin/bash -eo pipefail
export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
/bin/bash: emulator64-arm: command not found

Exited with code exit status 127

标签: androidandroid-emulatorcontinuous-integrationcirclecicircleci-2.0

解决方案


推荐阅读