CircleCi无法解决Android的构建工具

时间:2016-09-24 16:35:15

标签: android gradle circleci

我正在尝试将CircleCi与我的Android项目一起使用我添加了circle.yml文件,但每次构建失败并出现以下错误

  

配置项目':app'时出现问题。   找不到Build Tools修订版23.0.1

以下是我的circle.yml文件

#
# Build configuration for Circle CI
#

general:
    artifacts:
        - /home/ubuntu/ES-NRP-Android-V3/app/build/outputs/apk/

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

dependencies:
pre:
    - echo y | android update sdk --no-ui --all --filter "tools"
    - echo y | android update sdk --no-ui --all --filter "build-tools-23.0.1"
    override:
        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-23.0.1,android-23,extra-google-m2repository,extra-google-google_play_services,extra-android-support
        - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
    override:
        - (./gradlew assemble):
timeout: 360

我的目标是SDK版本23和构建工具23.0.2

2 个答案:

答案 0 :(得分:3)

我的目标是Sdk 25,这是我工作的cicle.yml文件:

general:
    artifacts:
          - /home/ubuntu/your-app-name/app/build/outputs/apk/

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


dependencies:
    pre:
        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,extra-google-m2repository,extra-google-google_play_services,extra-android-support,android-25
        - echo y | android update sdk --no-ui --all --filter build-tools-25.0.0               
        - if [ ! -d "/usr/local/android-sdk-linux/platforms/android-25" ]; then echo y | android update sdk --no-ui --all --filter "android-25"; fi
        - if [ ! -d "/usr/local/android-sdk-linux/build-tools/25.0.0" ]; then echo y | android update sdk --no-ui --all --filter "build-tools-25.0.0"; fi
        - if [ ! -d "/usr/local/android-sdk-linux/extras/android/m2repository/com/android/support/design/25.0.0" ]; then echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"; fi


    cache_directories:
        - /usr/local/android-sdk-linux/tools
        - /usr/local/android-sdk-linux/build-tools/25.0.0
        - /usr/local/android-sdk-linux/platforms/android-25
        - /usr/local/android-sdk-linux/extras/android/m2repository
test:
    override:
        - ./gradlew assemble
        - cp -r app/build/outputs $CIRCLE_ARTIFACTS

答案 1 :(得分:0)

测试我为Android项目forandroid版本制作的CircleCi.yml文件:24

  

https://gist.github.com/mirhoseini/579cdf1b78a73738813ae5de71ceceb4

我希望它有所帮助:)