我真的很喜欢 Android 的 ProGuard / Release 版本。我尝试将我的应用程序上传到 Play 商店,但每次我修复某些问题时都会出现另一个错误。而且这只发生在发布模式下。经过大量试验和错误后,我的应用程序在 Play 商店中。以前它会在启动时崩溃(通过在 ProGuard 设置中添加类来修复)。然后Facebook不会登录(通过添加修复
-keep class com.facebook.** {
*;
}
到 ProGuard 设置。
现在,当我尝试连接 Facebook 的 Open Graph 并发布消息时,我的应用程序崩溃了。我收到此错误,但在网上找不到任何关于它的信息:
04-02 18:09:20.160: E/AndroidRuntime(16163): FATAL EXCEPTION: main
04-02 18:09:20.160: E/AndroidRuntime(16163): com.facebook.FacebookGraphObjectException: Factory can't proxy method: public abstract java.lang.String com.xxxx.views.am.a()
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.facebook.model.GraphObject$Factory.verifyCanProxyClass(SourceFile:270)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.facebook.model.GraphObject$Factory.createGraphObjectProxy(SourceFile:196)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.facebook.model.GraphObject$Factory.access$0(SourceFile:195)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.facebook.model.GraphObject$Factory$GraphObjectProxy.proxyGraphObjectMethods(SourceFile:530)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.facebook.model.GraphObject$Factory$GraphObjectProxy.invoke(SourceFile:470)
04-02 18:09:20.160: E/AndroidRuntime(16163): at $Proxy3.cast(Native Method)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.facebook.Response.getGraphObjectAs(SourceFile:124)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.xxxxx.views.aa.a(SourceFile:432)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.xxxxxx.views.aa.a(SourceFile:419)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.xxxxx.views.ag.a(SourceFile:377)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.xxxxx.views.ag.onPostExecute(SourceFile:1)
04-02 18:09:20.160: E/AndroidRuntime(16163): at android.os.AsyncTask.finish(AsyncTask.java:631)
04-02 18:09:20.160: E/AndroidRuntime(16163): at android.os.AsyncTask.access$600(AsyncTask.java:177)
04-02 18:09:20.160: E/AndroidRuntime(16163): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
04-02 18:09:20.160: E/AndroidRuntime(16163): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 18:09:20.160: E/AndroidRuntime(16163): at android.os.Looper.loop(Looper.java:137)
04-02 18:09:20.160: E/AndroidRuntime(16163): at android.app.ActivityThread.main(ActivityThread.java:4931)
04-02 18:09:20.160: E/AndroidRuntime(16163): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 18:09:20.160: E/AndroidRuntime(16163): at java.lang.reflect.Method.invoke(Method.java:511)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
04-02 18:09:20.160: E/AndroidRuntime(16163): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
04-02 18:09:20.160: E/AndroidRuntime(16163): at dalvik.system.NativeStart.main(Native Method)
ProGuard 是否仍在剥离我正在使用的代码?什么设置可以解决这个问题?作为记录..在构建模式下一切都很好。
另一个问题。是否可以只禁用 ProGuard?我认为真的没用,只会给更多的问题。