fastlane cannot find gradlew file?

10.8k views Asked by At

Trying to get fastlane up and running for my Android project. I have the fastfile and appfile in my project directory, but when my lane executes the gradle action it fails with the following error:

Couldn't find gradlew at path '/Users/MyUser/Documents/Project/Android/gradlew'

Meanwhile, if I pull up that directory in Finder - the gradlew file is in fact present.

No clue what my next step should be here.. anyone have any similar problems or suggestions?

5

There are 5 answers

1
nserror On BEST ANSWER

I was able to resolve this by moving my Fastfile into a fastlane directory. Previously I had the fastlane files in the root of my project, moving them resolved the issue.

0
chathura On

I had the same issue, In that case, Gradle dir was not there. so I had to run 'gradle wrapper' command on the terminal to generate that dir in the project.

0
Prasanna Ramaswamy On

Not sure if this would help. I had a problem that fastlane didn't go to the right directory where gradlew existed (and complained about not finding gradlew). To overcome that, i changed directory to the location where gradlew is present in my project and ran 'fastalne init' again. That resolved my issue

0
suther On

I had the same issue, as I tried to place fastlane in my Project-Dir on same level as /ios and /android.

You can easily solve it by adding the project_dir parameter to your gradle-requests:

gradle(task: "clean assembleRelease", project_dir: 'android/')

1
JackDev On

I ran into this issue while trying to do an Android build on an ubuntu machine using Github actions (for my react-native app). Running it on a mac was fine (which is where I was running it locally initially).

Ended up writing a little bit of code to set the values on a linux machine:

  platform = RbConfig::CONFIG['host_os']

  gradle_path_value, project_dir_value = if platform =~ /linux/   # Linux/Ubuntu
    ["gradlew", "android/"]
  else
    [nil, nil]
  end