Pregunta

-libraryjars  <java.home>/lib/rt.jar

in the documentation for proguard it says that you use -libraryjars for jar files that were added to the project. I have added library jars in the libs folder and never had to use that. the files in the jars are alwasys obfuscated with the rest of the code. never had to change any of the settings for proguard for the stock settings.

the only changes that I have ever needed to do was remove some classes from modification by proguard to avoid errors. These have to do with serialization, or other issues for example in the GSON libraries.

here are some examples of how classes are removed from the obfuscation process by using the -keep command

-keep class sun.misc.Unsafe { *; }

-keep class com.google.gson.stream.** { *; }

-keep class com.myproject.testproject.MainActivity$TestObject { *; }

in comparison, I don't understand what the purpose of -libraryjars line in sample code. Even without using this line all the jars added in the libs folder of an Android project are obfuscated without any issues.

what is the use?

¿Fue útil?

Solución

You can find an explanation of their purpose in the ProGuard manual > Introduction.

The -injars/-libraryjars/-outjars options specify the input files and output files of ProGuard. The Android build process already specifies the necessary options for you, so you mustn't repeat them in your configuration file.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top