在android studio中设置dexguard许可证文件

时间:2015-06-30 07:10:37

标签: android android-studio dexguard

我没有在dexguard.please中找到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.

3 个答案:

答案 0 :(得分:12)

已经有一段时间了,因为有更新的答案,所以我想我会更新,因为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上构建。此解决方案使我无需在构建服务器本身上实现任何更改(即本地环境变量,将文件复制到服务器主目录或类路径选项)。我希望这可以帮助其他人偶然发现这个问题,并发现错误信息令人困惑。

答案 1 :(得分:2)

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

答案 2 :(得分:1)

一旦您登录该帐户,就可以下载许可证文件> https://www.guardsquare.com

上的文件页面

请参阅此screen shot