【问题标题】:Use %userprofile% in android build.gradle在 android build.gradle 中使用 %userprofile%
【发布时间】:2022-07-23 03:17:28
【问题描述】:

我想在我的 build.gradle 文件中使用 %userprofile% 的等效项来指定 buildDir 路径。我已经尝试了 %userprofile%, System.getenv('HOME') 和 $System.env.HOME ,最后两个都只是返回“null”

有没有办法在 build.gradle 文件中获取 %userprofile% 路径?

【问题讨论】:

  • 你确定你有一个名为'HOME'的环境变量吗?因为我认为System.getenv('HOME') 应该可以工作。使用System.getenv()打印所有环境变量,看看是否有HOME变量。

标签: android gradle android-gradle-plugin build.gradle gradle-plugin


【解决方案1】:

以下作品适合我:

System.getProperty("user.home")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多