Android procedures the ProGuard confusion and signature release

Write Android applications submitted for review, and have to start preparing to release before submitting it, or else do not sign someone else can pretend not to, and the other also need consider proguard the confusion, and reduce the file size. Default android sdk has been provided on the signature tool, right on the project, Eclipse android tools -> Export Signed the Application Package …. Follow-up is to establish key and export the signature process is very simple, all the way in accordance with the operating go on, the primary records of several ProGuard confusion attention problems.

Need to the ProGuard confuse the need for several steps:

(1) the project.properties add:

proguard.config = proguard.cfg

(2) in proguard.cfg in set (by default the file has been generated, there is a need when the need to add rules set)

(3) the android tools export signature

Encountered several problems, the record:

A third-party jar files confusion

(1) add-libraryjars label, on behalf of third-party jar files. Such as:-libraryjars lib / wmqtt.jar

(2) add a label-keep, class of third-party package which is set to confusion, such as:-keep class com.ibm. ** {*;}

(3) When in the export, found that many could not the reference the class sort of warning if to confirm the actual system operation and those references no problem, you can add the-dontwarn label will no longer be prompted to follow-up package warning. Such as :-dontwarn org.apache. **

(4) try not to write all ignore all warn that label, so you can own the console output of information for further adjustment.

2, on the the webview registered JavaScriptInterface call java class methods need not to confuse

In the confusion after the machine running webview method has been unable to call, decompile java class has been confusion. Such as calling the following:

String load = "javascript: window.JSMethod.getPin ('<head>' + document.getElementsByTagName ('html') [0]. InnerHTML + '</ head>')";

In fact getPin method has been confusion as a, or the like. So it is necessary that the method set-keep. Another if written like this:


-Keep class yourpack.JavaScriptInterface

This is not enough, inside the method will still be confused with out the need to specify in detail the corresponding method name and parameters, we should pay attention to is the full path name.


-Keep class yourpack.JavaScriptInterface {

public void getPin (java.lang.String);
}

Re-signature export, decompile, we can see this method in the class are not confused, while the other variables inside the class has been confused.

More detailed proguard document can Quguan network view.http://proguard.sourceforge.net/

本文固定链接: http://www.higis.org/en/2012/05/15/android-proguard-sign/ | Hi,GIS


该日志由 H.J 于2012年05月15日发表在 Program 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: Android procedures the ProGuard confusion and signature release | Hi,GIS
关键字: , , , ,

Android procedures the ProGuard confusion and signature release:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter