Setting up dexguard license file in android studio
Asked Answered
E

4

5

I didn't find dexguard-license.txt file in dexguard.please help me in gradle setup in android studio here is my gradle console output

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.
Evaporation answered 30/6, 2015 at 7:10 Comment(0)
S
2

The licence file is available to download once you've logged in on the account > files page on https://www.guardsquare.com

See this screen shot

Shipboard answered 1/7, 2015 at 6:44 Comment(5)
Thanks for the info, can you tell me the info about point(1)...location defined by the Java system propertyEvaporation
So a JVM system property can be set on command line, although for Android likely you'll want to set in in gradle like this: systemProperties['dexguard.license'] = './location/of/my/dexguard-license.txt'Shipboard
where i have add this line in gradle fileEvaporation
hmm seems to be in test task, but why not just use one of the other methods? (3) or (5) seem very simple to achieveShipboard
Make sure you use the same package name/bundle id as mentioned in the license file. It is case sensitive.Nitaniter
T
15

It's been a while since there was an updated answer, so I thought I'd update since there have been a change to DexGuard's license file setup.

I just updated from Android Studio version from 2.2.3 to 2.3 and also upgraded my Gradle version from 2.14.1 to 3.3. Upon upgrading to Gradle version 3.3, I received the same error that was documented by the 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.

My DexGuard configuration was working just fine using Gradle version 2.14.1 with my dexguard-license.txt file in the same directory as the DexGuard jar (suggestion #5).

It turns out that the documentation for DexGuard states the following:

Note: when using Gradle 3.1+, the license file will not be found anymore when placed in the same directory as the DexGuard plugin jar.

(Source: DexGuard 7.3.10 documentation -> Quick Start -> Setting up your license file)

I wanted to keep my license file in the same directory as the DexGuard jar, so I implemented suggestion #1. I did this by adding the following line to my project's gradle.properties file:

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

Note that my DexGaurd jar and my dexguard-license.txt files are located in the following directory: {project folder}/app/libs/DexGuard_7_3_10/

I went with this solution as I not only build locally but also on a Jenkins CI. This solution prevents me from having to implement any changes on the build server itself (i.e. local environment variable, copying files to server home directory, or class path options). I hope this helps someone else that stumbles upon this problem and finds the error message confusing.

Tyburn answered 7/3, 2017 at 19:48 Comment(3)
Travis could you help me to understand what am I doing wrong? Android Strudio 2.3.3 , gradle 3.3, my DexGuard path is : (project name)\app\libs\DexGuard-8.0.14, dexguard-license.txt path is : (project name)\app\libs\DexGuard-8.0.14\lib\dexguard-license.txt . Also I set systemProp.dexguard.license=./app/libs/DexGuard-8.0.14/lib/dexguard-license.txt in my gradle.properties file, but any way if I am trying to build project release mode, I get error Error:Execution failed for task ':app:dexguardRelease'. >IOException: Please check your DexGuard license (see build log for details).Thunderclap
@AlekseyTimoshchenko: It's been a while since I last modified this, but it looks like your systemProp.dexguard.license is incorrect. Instead of: systemProp.dexguard.license=./app/libs/DexGuard-8.0.14/lib/d‌​exguard-license.txt, try this: systemProp.dexguard.license=./app/libs/DexGuard-8.0.14/libTyburn
@TravisYim could you also paste the dexguard configuration you have please ! Its what is to be defined for path and license under dexguard{ .. }Witling
Q
3

You should copy dexguard-license.txt file and dexguard.jar file to your home directory(: /user/ironman).

Quijano answered 19/1, 2016 at 0:41 Comment(0)
S
2

The licence file is available to download once you've logged in on the account > files page on https://www.guardsquare.com

See this screen shot

Shipboard answered 1/7, 2015 at 6:44 Comment(5)
Thanks for the info, can you tell me the info about point(1)...location defined by the Java system propertyEvaporation
So a JVM system property can be set on command line, although for Android likely you'll want to set in in gradle like this: systemProperties['dexguard.license'] = './location/of/my/dexguard-license.txt'Shipboard
where i have add this line in gradle fileEvaporation
hmm seems to be in test task, but why not just use one of the other methods? (3) or (5) seem very simple to achieveShipboard
Make sure you use the same package name/bundle id as mentioned in the license file. It is case sensitive.Nitaniter
P
0

If you have dexguard-license.txt then you can define it under build.gradle as follows.

dexguard {

        version = '9.1.+'
  
        // Keep the license secure in your CD/CI
        **license = '/../YOURDIRECTORY/dexguard-license.txt'**
        configurations {
        release {
                ..
                ..
                
        }
        
    }
Pendant answered 10/4, 2022 at 15:51 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.