How to use proguard.config setting in project.prop

2019-09-19 02:31发布

I use eclipse and I guess ant building system. In my project root i have a project.properties file which contains proguard.config setting. This setting is said in sdk examples to either

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

or

proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt

I have found somewhere that you can state multiple files delimited by colon ":".

But nowhere it is explained in depth which of files takes precedence. I mean does this use file proguard-android.txt from {sdk.dir} folder or proguard-project.txt from project root folder or does it somehow merge the setting from the two. What is the correct usage? Should I reference both files: the one in {sdk.dir} folder as a default and my proguard-project.txt for project specific stuff? Or should I take proguard-android.txt or proguard-android-optimize.txt and use that as a base for my proguard-project.txt and modify accordingly? Basically, what is the correct usage or best practice? Experimenting and testing is a bit time consuming to say the least.

1条回答
混吃等死
2楼-- · 2019-09-19 03:09

In lack of better answer....

Via a completely unrelated google search I found by coincidence this:

http://tools.android.com/recent/proguardimprovements

As of ADT 17, the proguard.config property refers to a path instead, so you can specify as many configuration files as you want. These are all joined together by ProGuard.

...

Note that ProGuard typically doesn't let you subtract flags, so if you disagree with one of the default flags, you'll need to copy the global configuration into your own files and remove the lines you want to disable. One such flag you might want to consider is the -dontoptimize

Still very vague.

flag.

查看更多
登录 后发表回答