Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

android - DexGuard error while trying to enable minifying in ProGuard

I am trying to enable minifying in an Android app using ProGuard.

When I set minifyEnabled to false it builds but as soon as I set it to true:

buildTypes {

    debug {
        minifyEnabled false
        jniDebuggable true
        versionNameSuffix '_DEBUG'
        zipAlignEnabled true
    }
    release {
        minifyEnabled true
        proguardFile getDefaultDexGuardFile('dexguard-release.pro')
        proguardFile 'dexguard-project.txt'
        jniDebuggable false
        signingConfig signingConfigs.release
    }

I get a gradle syncing error:

ERROR: minifyEnabled is set to 'true' for variant <name of the variant>.

And stacktrace states:

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':MainApp'
Caused by: org.gradle.api.GradleException: Errors occurred during DexGuard plugin configuration.

What does DexGuard have to do here?

question from:https://stackoverflow.com/questions/65598419/dexguard-error-while-trying-to-enable-minifying-in-proguard

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Dexguard's documentation says:

DexGuard expects its inputs to be unobfuscated, so make sure none of the variants you specify here have the minifyEnabled options set to true.

You can't use both Dexugard and Proguard in the same library. You have to either disable Dexguard or Proguard.

Dexguard is an improved (and paid) version of Progurad. I don't see any reason for using Proguard when you have Dexguard.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...