简体   繁体   中英

Action failed: gradle dependencies CircleCi

I have integrated CircleCI to run Espresso test on my app. I have taken the following circle.yml file from another online github repo and changed the android build tools and android version to 25. However when I run the build on the circleCI server, I get the following error. I have granted the execution permission in yml file.

My app Repo structure is

在此处输入图片说明

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/wrapper/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/wrapper does contain gradle-wrapper.jar

A solution is on the circleCI forum. You have to add execution right like the following : chmod +x gradlew It works for me.

Here is an example of my 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/ \;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM