How to automatically generate proguard-android.txt?

烂漫一生 提交于 2019-12-30 09:35:17

问题


Reading all the wonderful things the new ProGuard Improvements for Android do, I switched to to the new scheme by uncommenting the following line in a newly created project:

proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt;proguard-project.txt

But when I try to export this project's APK, I am greeted with the following message:

Invalid proguard configuration file path C:\android-sdk-windows\tools\proguard\proguard-android.txt does not exist or is not a regular file

Well, I checked the directory C:\android-sdk-windows\tools\proguard and, sure enough, while this directory exists and has subdirectories and even a README file, proguard-android.txt is nowhere to be found.

BTW, I tried it with : instead of ; but that didn't seem to change anything.

Isn't Eclipse+ADT+Proguard supposed to generate this file automatically for me? What am I missing?

Also, where can I find a "standard" default set of rules for Android proguard-android.txt so that I can copy it over to its missing slot?


回答1:


It should either be generated or come with your sdk (I think). However, here is a link to the one that I have (tools r19). http://pastebin.com/7rNJkns0




回答2:


New Projects or old ones converted when changing API now in project.properties link to

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

You can simply link your projects proguard config by commenting the line and adding

proguard.config=proguard-project.txt

to it.

Cheers.




回答3:


I recommend creating a new project and copying the proguard-project.txt from there.

In eclipse, you can do that by going to File --> New --> Other --> Android --> Android Application Project. It's just in the root directory of the new project.




回答4:


Your declaration is:

proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt;proguard-project.txt

The Correct declaration is (: instead of;):

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


来源:https://stackoverflow.com/questions/11020256/how-to-automatically-generate-proguard-android-txt

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