如何在CircleCI

时间:2015-06-10 02:16:36

标签: android linux gradle android-gradle circleci

我正在使用CircleCI服务器来构建和测试Android应用程序,并且无法在服务器上安装适用于Google Play服务(包括GMS服务)的Android SDK。

我的circle.yml文件是:

environment:
          ANDROID_HOME: /usr/local/android-sdk-linux

dependencies:
  pre:
    - echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository
    - echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all

    - wget $DEBUG_KEYSTORE_URL
    - openssl des3 -d -pass env:DEBUG_KEYSTORE_PASSWORD -salt -in debug.keystore.encrypted  -out ~/.android/debug.keystore

test:
    override:
       - ./gradlew assembleDebug
    post:
      - cp -r app/build/outputs $CIRCLE_ARTIFACTS

第一个

- echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository

修复了Android SDK附加功能的早期问题,我认为第二行会安装所有剩余的组件:

- echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all

但是,我收到以下错误(如下)。

在尝试使用最新的Android SDK保持我的circle.yml文件时,我似乎仍然遇到类似的问题。任何建议都表示赞赏!

Download https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.0-beta1/gradle-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.0-beta1/gradle-core-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder/1.3.0-beta1/builder-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint/24.3.0-beta1/lint-24.3.0-beta1.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-parent/5.2.1/proguard-parent-5.2.1.pom
Download https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.3.6/groovy-all-2.3.6.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/1.3.0-beta1/builder-model-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/1.3.0-beta1/builder-test-api-1.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/sdklib/24.3.0-beta1/sdklib-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/sdk-common/24.3.0-beta1/sdk-common-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/common/24.3.0-beta1/common-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/build/manifest-merger/24.3.0-beta1/manifest-merger-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/24.3.0-beta1/ddmlib-24.3.0-beta1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-parent/5.0.3/asm-parent-5.0.3.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.pom
Download https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.9.0/jack-api-0.9.0.pom
Download https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.9.0/jill-api-0.9.0.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint-checks/24.3.0-beta1/lint-checks-24.3.0-beta1.pom
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4/ecj-4.4.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.pom
Download https://jcenter.bintray.com/com/android/tools/annotations/24.3.0-beta1/annotations-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/24.3.0-beta1/layoutlib-api-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/dvlib/24.3.0-beta1/dvlib-24.3.0-beta1.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/24.3.0-beta1/lint-api-24.3.0-beta1.pom
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.pom
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.pom
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.0-beta1/gradle-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.0-beta1/gradle-core-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/builder/1.3.0-beta1/builder-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/lint/lint/24.3.0-beta1/lint-24.3.0-beta1.jar
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.jar
Download https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.3.6/groovy-all-2.3.6.jar
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/1.3.0-beta1/builder-model-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/1.3.0-beta1/builder-test-api-1.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/sdklib/24.3.0-beta1/sdklib-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/sdk-common/24.3.0-beta1/sdk-common-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/common/24.3.0-beta1/common-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/build/manifest-merger/24.3.0-beta1/manifest-merger-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/24.3.0-beta1/ddmlib-24.3.0-beta1.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar
Download https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.9.0/jack-api-0.9.0.jar
Download https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.9.0/jill-api-0.9.0.jar
Download https://jcenter.bintray.com/com/android/tools/lint/lint-checks/24.3.0-beta1/lint-checks-24.3.0-beta1.jar
Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4/ecj-4.4.jar
Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar
Download https://jcenter.bintray.com/com/android/tools/annotations/24.3.0-beta1/annotations-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/24.3.0-beta1/layoutlib-api-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/dvlib/24.3.0-beta1/dvlib-24.3.0-beta1.jar
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/24.3.0-beta1/lint-api-24.3.0-beta1.jar
Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.jar
Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.jar
Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar

FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring project ':app'.
    > Could not resolve all dependencies for configuration ':app:_debugCompile'.
       > Could not find com.google.android.gms:play-services-maps:7.5.0.
         Searched in the following locations:
             http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
             http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
             https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
             https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
             https://jcenter.bintray.com/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
             https://jcenter.bintray.com/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
             https://maven.fabric.io/public/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
             https://maven.fabric.io/public/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
             file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
             file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
             file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.pom
             file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-maps/7.5.0/play-services-maps-7.5.0.jar
         Required by:
             project-android-app:app:unspecified
       > Could not find com.google.android.gms:play-services-location:7.5.0.
         Searched in the following locations:
             http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
             http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
             https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
             https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
             https://jcenter.bintray.com/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
             https://jcenter.bintray.com/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
             https://maven.fabric.io/public/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
             https://maven.fabric.io/public/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
             file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
             file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
             file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.pom
             file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-location/7.5.0/play-services-location-7.5.0.jar
         Required by:
             project-android-app:app:unspecified
       > Could not find com.google.android.gms:play-services-gcm:7.5.0.
         Searched in the following locations:
             http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
             http://dl.bintray.com/populov/maven/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
             https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
             https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
             https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
             https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
             https://maven.fabric.io/public/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
             https://maven.fabric.io/public/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
             file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
             file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
             file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.pom
             file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-gcm/7.5.0/play-services-gcm-7.5.0.jar
         Required by:
             project-android-app:app:unspecified

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED


    export TERM="dumb"
    ./gradlew dependencies
     returned exit code 1

    Total time: 19.331 secs Action failed: ./gradlew dependencies

2 个答案:

答案 0 :(得分:4)

经过大量调整后的解决方案似乎要求您在--filter选项中明确指定所需的组件。如果您不添加过滤器,则--all似乎不会为您提供所需的所有组件。

其他人修复:

ssh dependencies: pre: - echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository

答案 1 :(得分:3)

我收到同样的错误:     FAILURE:构建因异常而失败。     * 什么地方出了错:     配置根项目' android'。

时出现问题
  

无法解析配置的所有依赖项':_ debugCompile'。   找不到com.google.android.gms:play-services-location:7.5.0。

以下提示解决了这个问题:

echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository