2017-04-13 82 views
1

我已經集成了CircleCI以在我的應用程序上運行Espresso測試。我從另一個在線github倉庫中獲取了以下circle.yml文件,並將android構建工具和android版本更改爲25.但是,當我在circleCI服務器上運行構建時,出現以下錯誤。我已經在yml文件中授予了執行權限。操作失敗:Gradle依賴CircleCi

我的應用程序回購結構是

enter image description here

Action failed: gradle dependencies 

export TERM="dumb" 
if [ -e ./gradlew ]; then ./gradlew dependencies;else gradle dependencies;fi 
bash: line 2: ./gradlew: Permission denied 

export TERM="dumb" 
if [ -e ./gradlew ]; then ./gradlew dependencies;else gradle dependencies;fi 
returned exit code 126 

Action failed: gradle dependencies 

circle.yml:

general: 
    artifacts: 
     - /home/ubuntu/MyRideApp/app/build/outputs/apk/ 

machine: 
    environment: 
     ANDROID_HOME: /usr/local/android-sdk-linux 
     ADB_INSTALL_TIMEOUT: 240 
     GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx3072M -XX:+HeapDumpOnOutOfMemoryError"' 

dependencies: 
    pre: 
     - chmod +x gradlew 
     - touch app/google-services.json 
     - echo y | android update sdk --no-ui --all --filter "tools,android-25,build-tools-25.0.2,platform-tools,extra-android-m2repository,extra-android-support,extra-google-m2repository,extra-google-google_play_services" 
    cache_directories: 
     - /usr/local/android-sdk-linux/tools 
     - /usr/local/android-sdk-linux/build-tools/25.0.2 

    override: 
      - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies 

# Comment the test stuff out (or remove it) if you don't need it. 
test: 
    pre: 
    - emulator -avd circleci-android23 -no-audio -no-window: 
      background: true 
      parallel: true 
    - circle-android wait-for-boot 
    # unlock emulator 
    - sleep 30 
    - adb shell input keyevent 82 

    override: 
# - ./gradlew clean assemble 
    # This will run the tests: 
    - ./gradlew assemble connectedDebugAndroidTest -PdisablePreDex --console=plain --info 

    post: 
     - cp -r app/build/outputs $CIRCLE_ARTIFACTS 
     - cp -r app/build/outputs/androidTest-results/connected/ $CIRCLE_TEST_REPORTS 

gradle這個/包裝/ gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME 
distributionPath=wrapper/dists 
zipStoreBase=GRADLE_USER_HOME 
zipStorePath=wrapper/dists 
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 

/gradle這個/包裝確實包含的gradle-wrapper.jar

+0

這有點不清楚 - 全'如果[-e ./gradlew] ...'東西是不存在於circle.yml你已粘貼在這裏。 –

+0

我直接從他們的網站上的圓形控制檯上拿下它。你能告訴我如何找到完整的堆棧跟蹤? – user2498079

+0

我無法確定可以從哪裏運行。 CircleCI結果頁面表示這與哪個步驟相對應? –

回答

2

一種解決方案是在circleCI論壇。 您必須添加如下執行權:chmod + x gradlew 它適用於我。

這裏是我的circleci.yml的例子:

machine: 
    java: 
    version: oraclejdk8 

dependencies: 
    override: 
    - chmod +x gradlew 
    - ./gradlew dependencies 
test: 
    override: 
    - chmod +x grailsw 
    - ./grailsw test-app --non-interactive 
    post: 
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/ 
    - find . -type f -regex ".*/target/test-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;