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服務,但更新似乎不起作用。想知道是否遇到了這個問題,以及是否有修復 –

相關問題