Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
353 views
in Technique[技术] by (71.8m points)

obfuscation - Exporting an Android project while using proguard on adt&sdk 20

I've updated to the new adt&sdk 20, and I'm having problems with the new way Proguard is being used on Eclipse. I'm not a pro with Proguard at all, yet I've always used it and it worked quite easily. I simply edited the "project.properties" file and added there "proguard.config=proguard.cfg", and it worked.

Sadly, some changes were made that I can't find any information of how to work with them. The official website that talks about Proguard (in the Android website) still talks about the older way.

They wrote on the "project.properties" to uncomment the next line:

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

This didn't work, it gives me these errors when trying to export:

Proguard returned with error code 1. See console
java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
at proguard.shrink.Shrinker.execute(Shrinker.java:159)
at proguard.ProGuard.shrink(ProGuard.java:275)
at proguard.ProGuard.execute(ProGuard.java:101)
at proguard.ProGuard.main(ProGuard.java:492)

Can anyone help me with this? I never had to change the proguard.cfg file before and all was quite automatic. It was very rare that i had to do such a thing.

They also added a file "proguard-project.txt" which probably replaces the proguard.cfg and "extends" from the sdk folder's file, so i wonder: will it be ok to somehow reference to the file in the project instead (and put into the file the content of the "parent" file)? If so, how do I do that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If it was working fine before and you haven't learnt Proguard, just change this line:

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

to this line:

 proguard.config=proguard.cfg

then you'll have your old Proguard setup back, I'd recommend updating though, it should just work unless your using some 3rd party jars? These are what is it saying is missing and you should use the -keep flag to stop Proguard from removing them when it obfuscates.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...