Can't get Android build to work

Hi…

I’m new to Circle CI. I’ve written what’s supposed to be a simple script to simply build an Android app that’s been written in Kotlin. Apparently, the gradlew script isn’t found. I had thought that the working_directory was supposed to have been set. I’m apparently doing something wrong. Can anyone help?

version: 2
jobs:
  build:
    docker:
      - image: buildpack-deps:trusty # primary container
    working_directory: ~/project
    steps:
      - checkout
      - run:
          name: Gradle Build
          command: ./gradlew build

Try getting an SSH session and see where your gradlew has ended up. You could also convert that relative path to a fully-qualified one.

I was expecting the working directory to be:

/home/circleci/project/

But instead, the gradle ended up here:

/home/circleci/project/project/

I took your advice and used an absolute path, because I’m in a hurry and want to see how this new tool works.

Thanks!

1 Like

That’s strange - do you know what was causing the working directory to be incorrect like that?

I can’t explain the first instance of the “project” subdirectory, but I can explain the other instance.

I’ve arranged the directories within my repository in this manner:
root:

  • .circleci
  • .gitignore
  • <miscellaneous, but relevant folders>
  • project
    • app
    • gradlew
    • gradlew.bat

But after discovering and resolving that, I am now dealing with a different error:

#!/bin/bash -eo pipefail
/home/circleci/project/project/gradlew :app:androidDependencies

Project ‘app’ not found in root project ‘project’.

As you can see in my script, I tried to specify the project name, because the gradlew command somehow thinks my root project happens to be “project”. Another weird thing.

I wonder if CircleCI would be able to find the .circleci folder if I moved the directory into the project folder and try again… ???

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.