简体   繁体   中英

Android proguard and library projects

the proguard is killing me with messages like that one:

"[proguard] Warning: class [facebook/bin/classes/com/facebook/internal/FileLruCache$StreamHeader.class] unexpectedly contains class [com.facebook.internal.FileLruCache$StreamHeader]"

and the final warning is:

[proguard] Warning: there were 332 classes in incorrectly named files. [proguard] You should make sure all file names correspond to their class names. [proguard] The directory hierarchies must correspond to the package hierarchies. [proguard] If you don't mind the mentioned classes not being written out, [proguard]
you could try your luck using the '-ignorewarnings' option.

Seems to me I haven't adjusted the library projects that I am using (like facebook) with the proguard.

I don't really want to obfuscate the lib projects, but the lines

-keep class com.facebook.** { *; }

-keep interface com.facebook.** { *; }

does not to do the trick.

Can you enlighten me on that one? Thanks

Cfr. ProGuard manual > Troubleshooting > Warning: class file ... unexpectedly contains class ...

It seems that your configuration contains a -injars option that doesn't point to the root directory of the packages and classes (.../facebook/bin/classes).

However, the standard Android build process already specifies all necessary -injars options for you, so you shouldn't add any.

Ok, I fixed in with many -dontwarn options in proguard config file.

Also, I don't obfuscate anything that is not in my main package (-keepclass !com.yyy.** { *; } and keepinterface as well). This seems to work nicely.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM