我要设置脚本路径 对于我在 android 项目中的脚本,没有使用严格的路径( /User/Documents/MyApp/tools/script.sh
)以及 “工作目录” .
我知道我可以使用 “外部工具”但是这个解决方案不起作用,因为所有项目开发人员都必须使用“外部工具”设置导入我的 jar 文件
我可以写这个吗路径 使用 $项目文件目录$ 变量?
最佳答案
截至目前,有no direct way to use these variables在配置的路径值中。
或者,您可以创建一个 gradle
task
在 app/gradle
运行 shell 脚本的文件:
task runSS {
doLast{
exec {
// chmod u+rwx demo.sh to make file executable
executable "../demo.sh"
}
}
}
// other gradle tasks
Make sure to change the permission of the file to executable by using
chmod u+rwx file_name
.
现在运行文件:
输出:
关于android - 如何在 Android Studio 中为我的 Shell 脚本设置路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63937171/