构建失败 gradle

build failed in gradle

我需要执行一个 bash 脚本来在 android 应用构建时更改 strings.xml 中的值。这是我在 gradle 脚本

中使用的代码
    task packDex(type:Exec)  {

    commandLine 'sh /home/czhu/lokki/editxml.sh'
}

preBuild.dependsOn packDex

它失败了,只有几句话。

   :App:packDex FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':App:packDex'.
> A problem occurred starting process 'command 'sh /home/czhu/lokki/editxml.sh''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

通过我搜索了很多,但真的不知道如何解决。请帮帮我。

试试这个:

executable '/home/czhu/lokki/editxml.sh'

如果您在脚本中有一个 shebang,应该可以工作。 'commandLine' 是完整的命令行。然而,可执行文件应该是你想要的。