0

I can’t get the first build to finish successfully for my CircleCI 2.0 android project. At first I was getting the “permission denied” for gradlew, which was fixed by appending “sudo chmod +x gradlew”. This led to my current error:

chmod: cannot access 'androidDependencies': No such file or directory
Exited with code 1

I was following the steps outline in the following article. I know the obvious answer is that the file actually doesn’t exist, but what should “androidDependencies” be replaced with? This is my first time working with CircleCI, and my first time working with any CI software at all, so if this is an easy fix I apologize! Thanks for your help.

This is my circle.yml file:

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
      - run:
          name: Download Dependencies
          command: sudo chmod +x gradlew ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Run Tests
          command: ./gradlew lint test
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results
kevinivan05
  • 354
  • 4
  • 13

2 Answers2

0

I finally resolved the issue! I simply replaced the following line from my config.yml file from:

command: sudo chmod +x gradlew ./gradlew androidDependencies

to:

command: |
        sudo chmod +x gradlew 
        ./gradlew androidDependencies

The "|" character is to enable multi-line commands as denoted in the reference docs here.

kevinivan05
  • 354
  • 4
  • 13
0

Your answer is correct, to enable multi-line commands just add | but in your code, you have another line with a problem

- restore_cache:
      key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}

When you restore the cache you don't specify the same path as the save_cache step. I recommend you to add the line path to be like this

- restore_cache:
      paths:
        - ~/.gradle
      key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}

This way you can restore yout cache correctly