ProGuard,Parse Exception,NoSuchMethodError:android.net.SSLCertificateSocketFactory.getHttpSocketFactory

时间:2014-10-17 12:06:21

标签: android parse-platform proguard

如果我禁用了proguard,我的应用程序会在发布模式下正常运行。但每当我启用proguard时,它都会崩溃。我已相应更改了proguard-project.txt。

这是我得到的日志:

> 10-17 08:31:42.705: E/AndroidRuntime(20674): FATAL EXCEPTION: Thread-2016
10-17 08:31:42.705: E/AndroidRuntime(20674): java.lang.ExceptionInInitializerError
10-17 08:31:42.705: E/AndroidRuntime(20674):    at com.parse.Parse.initialize(Unknown Source)
10-17 08:31:42.705: E/AndroidRuntime(20674):    at com.myapp.android.view.l.run(Unknown Source)
10-17 08:31:42.705: E/AndroidRuntime(20674):    at java.lang.Thread.run(Thread.java:864)
10-17 08:31:42.705: E/AndroidRuntime(20674): Caused by: java.lang.NoSuchMethodError: android.net.SSLCertificateSocketFactory.getHttpSocketFactory
10-17 08:31:42.705: E/AndroidRuntime(20674):    at com.parse.ParseRequest.newHttpClient(Unknown Source)
10-17 08:31:42.705: E/AndroidRuntime(20674):    at com.parse.ParseRequest.<clinit>(Unknown Source)
10-17 08:31:42.705: E/AndroidRuntime(20674):    ... 3 more

这是我在proguard-project.txt中的配置

-keep class com.parse.**{ *; }
-dontwarn com.parse.**
-keep public class android.net.**{ *; }
-dontwarn android.net.**

1 个答案:

答案 0 :(得分:1)

我添加了两行,并解决了。

-dontwarn org.apache.http.**
-keep class org.apache.http.** { *; }