Glide: Using Glide with DexGuard

Created on 12 Jul 2016  路  17Comments  路  Source: bumptech/glide

The ProGuard configuration in the README is insufficient when using DexGuard, the commercial version of ProGuard. It requires one more directive for an app to work correctly:

-keepresourcexmlelements manifest/application/meta-data@value=GlideModule

I figure you might want to add this to the wiki and/or the primary documentation.

Glide Version: 3.7.0

enhancement non-library

Most helpful comment

@ernestp It says "for DexGuard only", just remove the line if you use ProGuard.

All 17 comments

Do you think it's sufficient to do this on master (v4), or you're reading the 3.0 branch's readme?

It's not tied to any particular version of Glide. DexGuard obfuscates the contents of the meta-data element in the Android Manifest, and this causes the "Unknown Type Class" IllegalArg to be thrown.

To be honest it's pretty niche. I suppose anywhere Google can find it is good enough.

I asked because I was interested in which README.md you did read.

I added it to the wiki: https://github.com/bumptech/glide/wiki/Configuration#keeping-a-glidemodule
and noted down to update the README as well.

I suppose anywhere Google can find it is good enough.

That's already done by you... this issue ;)

Just curious: what is the rationale behind DexGuard removing metadata from the manifest? Is skimming off those 100 bytes from the compiled XML worth it?

It's not about size, it's about obfuscation. Removing/scrambling as much information as possible to make the app harder (or at least more irritating) to reverse engineer. This includes assets and resources.

I'm getting Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.

java.io.IOException: proguard.ParseException: Unknown option '-keepresourcexmlelements' in line 317 of file '...../app/proguard-rules.pro'

Android Studio 2.2 Beta 3
Build #AI-145.3225885, built on August 26, 2016
JRE: 1.8.0_76-release-b03 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Gradle Plugin 2.1.3
Gradle 2.14.1

@ernestp It says "for DexGuard only", just remove the line if you use ProGuard.

@TWiStErRob main page says ProGuard but ProGuard throws with -keepresourcexmlelements - should be mentioned imho

@black-snow #1666 fixes this

@TWiStErRob great!

I'm going to close this, if there's more changes needed feel free to make PR against master/README.md or comment to request Wiki updates.

In my case, I found this error when create release apk.

  • App module have lib module.
  • Lib module have Glide and use Dexguard -keepresourcexmlelements manifest/application/meta-data@value=GlideModule.
  • App module use Proguard.

How can i fixed it?

-keep class okhttp3.internal.publicsuffix.PublicSuffixDatabase

Doesn't helped to fix the issue for me... I have the same issue as mentioned by @oatpano

Unknown option '-keepresourcexmlelements'

Why this issue is closed?

@squm why do you think it shouldn't be closed?

Was this page helpful?
0 / 5 - 0 ratings