我试图从我的命令行运行gradlew,但不断面临以下错误。

Brendas-MacBook-Pro:appx_android brendalogy$ ./gradlew compileDebug --stacktrace
-bash: ./gradlew: Permission denied

我已经在我的项目目录中运行这个命令。需要运行这个命令,因为我在Android Studio 0.2上面临相同的(非描述性)错误。Android studio和gradle的构建错误

我是否做错了什么,我该如何解决这个问题?


当前回答

Git update-index——chmod=+x gradlew

这个命令在非unix系统上工作得更好。

其他回答

试试下面的命令:

chmod +x gradlew && ./gradlew compileDebug --stacktrace

还可以固定用吗

git update-index --chmod=+x gradlew

通过这一步设置gradlew的权限

steps {
    echo 'Compile project'
    sh "chmod +x gradlew"
    sh "./gradlew clean build --no-daemon"
}

试着在gradlew文件上设置执行标志:

CHMOD +X Gradlew

在你的终端经过它: Chmod 755 android/gradlew。