Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up dexguard license file in android studio

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.
like image 326
Santhosh Avatar asked Jun 30 '15 07:06

Santhosh


People also ask

How to add DexGuard in Android Studio?

To install it, go to your Android Studio Preferences > Plugins and click “Install plugin from disk…”. Browse to the studio folder in your DexGuard download and double-click to install. - DexGuard includes optimized configuration for popular frameworks such as Crashlytics, Firebase, Dagger, okHttp etc.

What is DexGuard Android?

What is DexGuard? DexGuard provides all the functionality of ProGuard with the addition of numerous code hardening techniques to guard mobile applications against reverse engineering and tampering. DexGuard is primarily intended for Android mobile applications which need robust code protection and code optimization.


1 Answers

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.

like image 133
Travis Yim Avatar answered Sep 23 '22 22:09

Travis Yim