Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot access './gradlew': No such file or directory Github actions

I am using workflow on GithubActions but getting the following error:

chmod: cannot access './gradlew': No such file or directory
Error: Process completed with exit code 1.

Following is my workflow.yml file

name: Android CI

on:
 push:
branches: [ develop ]
 pull_request:
branches: [ develop ]

jobs:
  build:

  runs-on: ubuntu-latest

  steps:
  - uses: actions/checkout@v1
  - name: Set up JDK 1.8
  uses: actions/setup-java@v1
  with:
    java-version: 1.8
- name: Change wrapper permissions
  run: chmod +x ./gradlew
- name: Build with Gradle
  run: ./gradlew build

I tried you change chmod command in a different way but non of execution succeed, but same workflow on my other project is working file i don't know whats the issue, Any help highly appreciated. Thanks

like image 208
Jhaman Das Avatar asked Aug 31 '25 18:08

Jhaman Das


2 Answers

It's possible that you don't initialise wrapper.

You can try clone your repository from scratch and the exetuce ./gradlew build command. If it's failed. Try use the

gradle wrapper

This command init your wrapper and you can see which files was generated and required for ./gradlew

Finally, You have two options:

  • Run gradle wrapper locally and push required files

or

  • Add extra step to init wrapper during the workflow

    ...
    
    jobs:
      build:
      runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v1
    - name: Set up JDK 1.8
    uses: actions/setup-java@v1
    with:
      java-version: 1.8
    - name: Change wrapper permissions
      run: chmod +x ./gradlew
    
    - name: Init gradle wrapper
      run: gradle wrapper
    
    - name: Change wrapper permissions
      run: chmod +x ./gradlew
    
    - name: Build with Gradle wrapper
      run: ./gradlew build
    
like image 77
Ivan Danilov Avatar answered Sep 02 '25 09:09

Ivan Danilov


I have faced the same issue and I found someone change it to

  • name: gradlew run: gradle enter image description here with removing "./" and "w"

and worked for me

like image 30
khafagaaa Avatar answered Sep 02 '25 08:09

khafagaaa