android - 如何在 Android Studio 中为我的 Shell 脚本设置路径?

标签 android android-studio run-configuration

我要设置脚本路径 对于我在 android 项目中的脚本,没有使用严格的路径( /User/Documents/MyApp/tools/script.sh )以及 “工作目录” .
我知道我可以使用 “外部工具”但是这个解决方案不起作用,因为所有项目开发人员都必须使用“外部工具”设置导入我的 jar 文件
我可以写这个吗路径 使用 $项目文件目录$ 变量?
enter image description here

最佳答案

截至目前,有no direct way to use these variables在配置的路径值中。
或者,您可以创建一个 gradle taskapp/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.


现在运行文件:
enter image description here
输出:
enter image description here

关于android - 如何在 Android Studio 中为我的 Shell 脚本设置路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63937171/

相关文章:

java - RFID + Android --> 我从哪里开始?

java - 如何修复在 JAR 文件中指定 "no main manifest attribute"的错误?

android - 是否可以在没有应用程序源代码的情况下查看 log cat 的输出?

linux - 我可以在 Eclipse 运行配置中运行脚本吗?

java - 一个 ScrollView 只能有一个子 Android XML 文件

android - 将 100 个 Activity 应用程序移植到 Fragments 而不死

android - 子文件夹产生 "Package R does not exist"

android - 有 Intent 地运行 Android Activity

android - Eclipse 在创建 android junit 测试配置时抛出 java.lang.NullPointerException

Android 4.2 with 4 MediaPlayers = "Can' t play this video"