Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

android - Travis.yml ./gradlew : Permission denied

Using Travis CI for an existing Android project calling

$ ./gradlew build connectedCheck

I get this error:

/home/travis/build.sh: line 45: ./gradlew: Permission denied
The command "./gradlew build connectedCheck" failed and exited with 126 during .
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It depends by the exec-permission to your unix gradlew script.

It can be fixed using the command:

git update-index --chmod=+x gradlew

A little desciption to understand the problem.
First of all you can check your permissions using:

git ls-tree HEAD

You will see:

100644 blob xxxxxxxxxxx gradlew

As you can see the file has 644 permission.

Fix it by setting the executable flag on your gradlew file changing it to 755:

git update-index --chmod=+x gradlew

Just commit and push the changes:

git commit -m "permission access for travis"

[master e80ab1b] gradlew permission access for travis
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 gradlew

A last check running git ls-tree again to see the change:

git ls-tree HEAD

You can see:

100755 blob xxxxxxxxxxxxx   gradlew

Another way to solve this issue is to use:

before_install:
 - chmod +x gradlew

This kind of solution doesn't change the permission in your git repo, but just changes the permission runtime in the execution.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...