Software⏱️ 2 min read📅 2026-05-31

How to Fix: Travis.yml ./gradlew : Permission denied

Error in Travis CI build due to permission denied for gradlew. Solution involves changing ownership or adding execute permissions.

Quick Answer: Change the ownership of the gradlew file to the current user or add execute permissions using chmod.

The 'Permission denied' error when running `./gradlew` in Travis CI indicates that the script does not have the necessary permissions to execute the Gradle command. This is often due to the default Travis CI user account not having the required privileges.

🔧 Proven Troubleshooting Steps

Method 1: Granting Execute Permissions

  1. Step 1: Run the command `sudo chown -R $TRAVIS_USER:$TRAVIS_GROUP /home/travis` to change the ownership of the Travis CI directory to the user and group specified in your `.travis.yml` file.

Method 2: Using the `sudo` Command

  1. Step 1: Modify your `.travis.yml` file to run the `./gradlew` command with elevated privileges by adding the line `sudo: true` in the `before_script` section.

💡 Conclusion

By following these steps, you should be able to resolve the 'Permission denied' error and successfully build your Android project in Travis CI.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions