1、编译的过程遇到各种警告:
增加如下两段代码
-dontwarn com.xx.bbb.**
-keep class com.xx.bbb.** { *;}
参数来保持第三方库中的类而不乱,-dontwarn和-keep 结合使用,意思是保持com.xx.bbb.**这个包里面的所有类和所有方法而不混淆,接着还叫ProGuard不要警告找不到com.xx.bbb.**这个包里面的类的相关引用。
2、加入新浪微博sdk遇到的问题
Proguard returned with error code 1. See console
Note: there were 1 duplicate class definitions.
Warning: library class android.webkit.WebViewClient depends on program class android.net.http.SslError
Warning: there were 1 instances of library classes depending on program classes.
You must avoid such dependencies, since the program classes will
be processed, while the library classes will remain unchanged.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
根据异常相信同行们已经看出来了,还要单独keep 一下SslError这个,因为这个东西没有在 com.weibo.sdk.android这个包里面,于是再加上:
-dontwarn android.net.http.**
-keep class android.net.http.** { *;}
3、对于引入了第三方Library,以actionbarsherlock为例
#actionbarsherlock start
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
#actionbarsherlock start
4、Conversion to Dalvik format failed with error
对于这个问题注释掉了下面的代码启用了上面的代码,上面的代码是防止方法调用的栈太多导致的溢出,下面的意思猜测可能是只允许5层嵌套的方法,明天再确定一下
-dontoptimize
#-optimizationpasses 5