I got this error for first attempt to login facebo

2019-06-14 15:17发布

问题:

I searched very much but I did not see the real solution. Somebody says use ex facebook sdk , is it the real solution?(I use facebook 3.6 but somebody says on stackoverflow use 3.2) I use proguard,

com.facebook.aq: com.facebook.c.f got an unexpected method signature: public abstract java.lang.Object com.facebook.c.c.e()
at com.facebook.c.h.a(Unknown Source)
at com.facebook.c.f.invoke(Unknown Source)
at $Proxy0.e(Native Method)
at com.facebook.b.al.a(Unknown Source)
at com.facebook.b.al.a(Unknown Source)
at com.facebook.f.run(Unknown Source)
at java.util.Timer$TimerImpl.run(Timer.java:284)

回答1:

You should use the latest facebook sdk and you should login with using app_secret like this :

  String access_token = sharedPrefs.getString("access_token", app_secret );
        Long expires = sharedPrefs.getLong("access_expires", -1);
    mFacebook.setAccessToken(access_token);
                mFacebook.setAccessExpires(expires);

(I think this solves your problem bacause you have a problem just the first login )



回答2:

There are some settings that you need to set for proguard.

The number of posts can explain the right way.

Check them out.

Some are listed below:-

1) Using Signature - Error-on-using-proguard-with-android-facebook-sdk-3-0.

So you use -

-keepattributes Signature

2) Android-facebook-connect-not-working-in-release-build.-

So, issue can be with your proguard configuration settings:

  • proguard.cfg (ERROR)

-keep class com.facebook.android.*

-keepclassmembers public class com.facebook.android.Facebook { 

    public static final *; 
}
  • proguard.cfg (WITHOUT ERROR)

-keep class com.facebook.android.*

-keep class android.webkit.WebViewClient

-keep class * extends android.webkit.WebViewClient

-keepclassmembers class * extends android.webkit.WebViewClient { 
    <methods>; 
}

3) Android ProGuard settings for Facebook