【问题标题】:Setting up dexguard license file in android studio在 android studio 中设置 dexguard 许可证文件
【发布时间】:2015-09-16 20:50:08
【问题描述】:

我没有在 dexguard 中找到 dexguard-license.txt 文件。请帮助我在 android studio 中设置 gradle 这是我的 gradle 控制台输出

Executing tasks: [:app:assembleDebug]
.....
Can't find a DexGuard license file.
You should place your license file dexguard-license.txt
1) in a location defined by the Java system property 'dexguard.license',
2) in a location defined by the OS environment variable 'DEXGUARD_LICENSE',
3) in your home directory, 
4) in the class path, or
5) in the same directory as the DexGuard jar.

【问题讨论】:

    标签: android android-studio dexguard


    【解决方案1】:

    已经有一段时间没有更新答案了,所以我想我会更新,因为 DexGuard 的许可证文件设置发生了变化。

    我刚刚从 Android Studio 版本从 2.2.3 更新到 2.3,并将我的 Gradle 版本从 2.14.1 升级到 3.3。升级到 Gradle 3.3 版后,我收到了 OP 记录的相同错误:

    Can't find a DexGuard license file.
    You should place your license file dexguard-license.txt
    1) in a location defined by the Java system property 'dexguard.license',
    2) in a location defined by the OS environment variable 'DEXGUARD_LICENSE',
    3) in your home directory, 
    4) in the class path, or
    5) in the same directory as the DexGuard jar.
    

    我的 DexGuard 配置使用 Gradle 版本 2.14.1 和我的 dexguard-license.txt 文件在与 DexGuard jar 相同的目录中运行良好(建议 #5)。

    事实证明,DexGuard 的文档说明如下:

    注意:使用 Gradle 3.1+ 时,与 DexGuard 插件 jar 放在同一目录下时,将找不到许可证文件。

    (来源:DexGuard 7.3.10 文档 -> 快速入门 -> 设置您的许可证文件)

    我想将我的许可证文件保存在与 DexGuard jar 相同的目录中,因此我实施了建议 #1。我通过在我的项目的 gradle.properties 文件中添加以下行来做到这一点:

    systemProp.dexguard.license=./app/libs/Dexguard_7_3_10
    

    请注意,我的 DexGaurd jar 和我的 dexguard-license.txt 文件位于以下目录中:{project folder}/app/libs/DexGuard_7_3_10/

    我选择了这个解决方案,因为我不仅在本地构建,而且还在 Jenkins CI 上构建。此解决方案使我不必对构建服务器本身进行任何更改(即本地环境变量、将文件复制到服务器主目录或类路径选项)。我希望这可以帮助其他偶然发现此问题并发现错误消息令人困惑的人。

    【讨论】:

    • 特拉维斯你能帮我理解我做错了什么吗? Android Strudio 2.3.3gradle 3.3,我的 DexGuard 路径是:(project name)\app\libs\DexGuard-8.0.14,dexguard-license.txt 路径是:(project name)\app\libs\DexGuard-8.0.14\lib\dexguard-license.txt。我还在我的gradle.properties 文件中设置了systemProp.dexguard.license=./app/libs/DexGuard-8.0.14/lib/dexguard-license.txt,但是如果我尝试构建项目发布模式,我会收到错误Error:Execution failed for task ':app:dexguardRelease'. >IOException: Please check your DexGuard license (see build log for details).
    • @AlekseyTimoshchenko:我上次修改它已经有一段时间了,但看起来你的 systemProp.dexguard.license 不正确。而不是:systemProp.dexguard.license=./app/libs/DexGuard-8.0.14/lib/d‌​exguard-license.txt,试试这个:systemProp.dexguard.license=./app/libs/DexGuard-8.0。 14/lib
    【解决方案2】:

    您应该将 dexguard-license.txt 文件和 dexguard.jar 文件复制到您的主目录(:/user/ironman)。

    【讨论】:

      【解决方案3】:

      https://www.guardsquare.com 上的帐户 > 文件页面登录后,即可下载许可证文件

      看到这个screen shot

      【讨论】:

      • 感谢您的信息,您能告诉我关于点(1)的信息吗...由 Java 系统属性定义的位置
      • 因此可以在命令行上设置 JVM 系统属性,尽管对于 Android,您可能希望像这样在 gradle 中设置:systemProperties['dexguard.license'] = './location/of/my/dexguard-license.txt'
      • 我在 gradle 文件中添加了这一行
      • hmm 似乎在test 任务中,但为什么不使用其他方法之一呢? (3) 或 (5) 似乎很容易实现
      • 确保使用与license 文件中提到的相同的package name/bundle id。它区分大小写。
      猜你喜欢
      • 2013-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-09
      • 1970-01-01
      • 2023-02-11
      • 2022-06-13
      • 2015-04-29
      相关资源
      最近更新 更多