1

我正在使用circle.ci在模拟器上测试我的代码。Android AVD与Circle.ci上的Google Play服务

我有一些espresso测试,至少使用地图和谷歌地方api。这些测试没有通过circle.ci给出的模拟器

于是,我就做我自己的工作,在circle.yml

machine: 
    environment: 
    PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-2.9/bin:$PATH" 
    TERM: "dumb" 
    ADB_INSTALL_TIMEOUT: "10" 
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"' 

dependencies: 
    pre: 
    - android list targets 
    - wget "https://services.gradle.org/distributions/gradle-2.9-bin.zip"; unzip gradle-2.9-bin.zip 
    - android list sdk -a -e 
    - echo y | android update sdk --no-ui --all --filter build-tools-23.0.2 
    - echo y | android update sdk --no-ui --all --filter tool,android-22,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,addon-google_apis-google-22 
    - echo y | android update sdk --no-ui --all --filter sys-img-armeabi-v7a-google_apis-22 
test: 
    override: 
    - echo no | android create avd -n avd22 -t 12 --abi google_apis/armeabi-v7a 
    - emulator -avd avd22 -no-audio -no-window: 
     background: true 
     parallel: true 

可悲的是,即使我当我运行android update sdk --no-ui --all --filter sys-img-armeabi-v7a-google_apis-22如果我做了android list target看起来好像是我的形象是不是availble的:

id: 12 or "Google Inc.:Google APIs:22" 
    Name: Google APIs 
    Type: Add-On 
    Vendor: Google Inc. 
    Revision: 1 
    Description: Android + Google APIs 
    Based on Android 5.1.1 (API level 22) 
    Libraries: 
     * com.google.android.media.effects (effects.jar) 
      Collection of video effects 
     * com.android.future.usb.accessory (usb.jar) 
      API for USB Accessories 
     * com.google.android.maps (maps.jar) 
      API for Google Maps 
    Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in 
Tag/ABIs : no ABIs. 

如果有人有一个解决方案中使用与播放服务circle.ci模拟器这将是对我非常有用...

回答

2

了很多尝试我终于可以打造一款Android AVD使用这个配置文件播放服务后:

machine: 
    environment: 
    PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-2.9/bin:$PATH" 
    TERM: "dumb" 
    ADB_INSTALL_TIMEOUT: "10" 
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"' 
dependencies: 
    pre: 
    - echo y | android update sdk --no-ui --all --filter tools 
    - echo y | android update sdk --no-ui --all --filter platform-tools 
    - echo y | android update sdk --no-ui --all --filter extra-android-m2repository 
    - echo y | android update sdk --no-ui --all --filter extra-android-support 
    - echo y | android update sdk --no-ui --all --filter extra-google-google_play_services 
    - echo y | android update sdk --no-ui --all --filter extra-google-m2repository 
    - echo y | android update sdk --no-ui --all --filter android-22 
    - echo y | android update sdk --no-ui --all --filter build-tools-23.0.2 
    - echo y | android update sdk -a -u -t sys-img-armeabi-v7a-google_apis-22 
    - android list targets 
test: 
    override: 
    - echo no | android create avd -n custom-android22-googleapis -t "android-22" --abi google_apis/armeabi-v7a 
    - android list avd 
    - emulator -avd custom-android22-googleapis -no-audio -no-window: 
     background: true 
     parallel: true 
    # wait for emulator to have booted 
    - circle-android wait-for-boot 
    # Sleeping isn't a brilliant fix... 
    - sleep 30 
    - fb-adb rcmd screencap -p > $CIRCLE_ARTIFACTS/screen-$(date +"%T").png 
    - adb shell input keyevent 82 
    - ./gradlew connectedAndroidTest -PdisablePreDex --console=plain --info 
    #- fb-adb devices 
    - fb-adb rcmd screencap -p > $CIRCLE_ARTIFACTS/screen-$(date +"%T").png 
+1

我有这方面的工作很好,但现在有一个问题,即一个对话框块的UI。它表示模拟器需要更新的Google Play服务,但更新似乎不起作用。想知道是否遇到了这个问题,以及是否有修复 –