使用proguard生成带有公共库的apk

时间:2014-03-06 17:25:32

标签: android eclipse proguard

我的项目中有以下库

As jar:
httpcore-4.3.1.jar
httpmime-4.3.2.jar
libGoogleAnalyticsServices.jar (latest GA version)

As import project
facebookSDK 3.6

我已将以下内容添加到proguard-project.txt

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
-keep class org.apache.**
-keep interface org.apache.**
-keep class com.facebook.** { *; }
-keepattributes Signature
-dontwarn org.apache.**

并在属性中

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

它可以生成签名的apk,但会抛出异常

NoSuchMethodError: org.apache.http.params.HttpConnectionParams...

如何解决问题?我已经添加了keep类了吗?谢谢你的帮助

1 个答案:

答案 0 :(得分:0)

{ *; }放在-keep interface org.apache.**的末尾和那些 - 保持规则