从Google Play商店下载时签名APK崩溃

时间:2015-05-27 05:51:12

标签: android eclipse android-facebook android-proguard

我在我的应用中使用Facebook SDK Login with Facebook,当我在我的真实设备中使用unsigned APK或安装signed APK时,应用效果非常好。但是,当我在Play商店上传相同的已签名APK并下载并运行时,会出现以下错误日志。

我已尝试在progaurd-project.txt文件中添加以下代码。

-keep class com.facebook.** {
   *;
}

我的 project.property 文件是:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=Google Inc.:Google APIs:22
android.library.reference.1=..\\google-play-services_lib
android.library.reference.2=..\\CircularImageViewLib
android.library.reference.3=..\\VKOpenAuthActivitySDK
android.library.reference.4=..\\android-support-v7-appcompat
android.library.reference.5=..\\FourSquareLib
android.library.reference.6=..\\..\\..\\git\\StickyScrollViewItems\\library
android.library.reference.7=..\\Cropper
android.library.reference.8=..\\FacebookSDK\\FacebookSDK
android.library.reference.9=..\\LDrawerLib
android.library.reference.10=../LinkedinSDK

我的 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 com.facebook.** {
   *;
}

错误日志是:

com.facebook.an: com.facebook.b.f got an unexpected method signature: public abstract org.json.JSONObject com.facebook.b.c.c()
at com.facebook.b.h.a(Unknown Source)
at com.facebook.b.f.b(Unknown Source)
at com.facebook.b.f.invoke(Unknown Source)
at java.lang.reflect.Proxy.invoke(Proxy.java:397)
at $Proxy0.c(Unknown Source)
at com.facebook.internal.cj.a(Unknown Source)
at com.facebook.internal.cj.onPostExecute(Unknown Source)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5944)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)

我已经检查了我已发布的Keyhash,并在Facebook上添加了它。

已经尝试的解决方案:

  1. Signed apk crashes with facebook login

  2. Android Facebook integration with proguard

  3. Facebook and proguard

  4. Android ProGuard settings for Facebook

  5. Error on exported apk - FacebookSDK

  6. I got this error for first attempt to login facebook.How can solve this?

1 个答案:

答案 0 :(得分:0)

根据以下内容更改proguard-project.txt文件:

-keepattributes Signature
-keep class com.facebook.model.** { *; }

-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}