Android: What is ProGuard and when do i need to use it?

我的未来我决定 提交于 2019-12-06 09:21:15

问题


I've built a news app that gets its contents from the news website using JSON, the app has GCM service (Push Notifications) so i have declared my SENDER-ID in the MainActivity and there is no user accounts. I think the only sensitive info here is the SENDER-ID.

So what exactly is ProGuard ? and do i need to use it in my app ?

(NOTE: I have read the documentations about ProGuard but i didn't quite understand when to use it).


回答1:


A tool which reduces size of your apk, optimze your code and obfuscates(makes code unclear, so that someone who has your APK can not easily decompile your APK and read the content of your code.

It's not a must to use ProGuard, but it surely helps you, there are several Pros to using it, and all you need to enable it is just to uncomment a single line and you are all set to go.

This is one good article on it




回答2:


ProGuard: java shrinker, optimizer, obfuscator, and preverifier.

  • Shrinker: Makes Java bytecode smaller (compiled .java files, i.e., .class files).
  • Optimizer: Makes Java bytecode more efficient by removing redundant instructions, changing instructions, or changing the execution order of instructions, so long that the overall results of the bytecode remain the same.
  • Obfuscator: Makes Java bytecode more difficult to decompile back into .java files by changing the instruction order, adding extraneous methods, and changing variable and class names to meaningless ones. This makes it harder for others to steal novelties from your application.
  • Preverifier: Checks that the bytecode is valid ahead of execution.



回答3:


ProGuard make your code unreadable, this is kind of protection if some one want to open your .apk and get super innovation methods & classes from it. But proguard is low level protection.



来源:https://stackoverflow.com/questions/29444554/android-what-is-proguard-and-when-do-i-need-to-use-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!