Android的 - Facebook的登录只对第一次引起onResume错误 [英] Android - Facebook login causes onResume error only for first time

查看:640
本文介绍了Android的 - Facebook的登录只对第一次引起onResume错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以成功连接到Facebook,并得到好友列表。所有的连接都OK。 但是,当我删除Facebook的数据(通过设置 - >应用程序)和我的应用程序的,出现登录问题。 [SDK 3.5]

I can successfully connect to facebook and get friendlist. All connections are OK. But when I delete data of Facebook(through settings->Applications) and my app's, a login problem occurs. [SDK 3.5]

  1. 在启动我的应用程序
  2. 请一个Facebook连接
  3. 的Facebook要求用户名和密码,进入他们
  4. 在等待一点点
  5. 这表明权限屏幕,询问用户基本信息和错误发生时:您的应用程序意外停止工作请再试一次(强制关闭)

当我点击强制关闭,一次又一次地发生同样的错误突然(同时允许屏幕还在后面)。如果我能足够快,我点击强制关闭,然后允许权限,一切都OK,我可以看到我的朋友。所以这个强制关闭错误意味着什么像什么?在日志中,有3-4个相同的致命异常的邮件,因为每次我点击强制关闭,再次出现错误。 当我尝试应用在我的手机(SE的Xperia弧S,2.3.3)会出现此错误。但是,当我尝试在仿真器,不会发生错误。它的工作原理没有问题。 (仿真器是2.3.3和4.2)

When I click Force Close, same error occurs again and again suddenly(while permission screen is still behind). If I can be quick enough, I click Force Close and then Allow Permission, everything goes OK and I can see my friends. So this FORCE CLOSE error means something like nothing? In the log, there are 3-4 of same Fatal Exception messages because each time I click FORCE CLOSE, the error occurs again. This error occurs when I try application on my phone(SE Xperia Arc S, 2.3.3). But when I try on Emulators, the error doesn't occur. It works without problem. (emulators are 2.3.3 and 4.2)

    09-04 18:09:47.916 E/AndroidRuntime(29511): FATAL EXCEPTION: main
09-04 18:09:47.916 E/AndroidRuntime(29511): java.lang.RuntimeException: Unable to resume activity {com.ilanharitasi/com.facebook.LoginActivity}: java.lang.NullPointerException
09-04 18:09:47.916 E/AndroidRuntime(29511): Caused by: java.lang.NullPointerException
09-04 18:09:47.916 E/AndroidRuntime(29511):     ... 12 more
09-04 18:09:51.526 E/AndroidRuntime(29538): FATAL EXCEPTION: main
09-04 18:09:51.526 E/AndroidRuntime(29538): java.lang.RuntimeException: Unable to resume activity {com.ilanharitasi/com.facebook.LoginActivity}: java.lang.NullPointerException
09-04 18:09:51.526 E/AndroidRuntime(29538): Caused by: java.lang.NullPointerException
09-04 18:09:51.526 E/AndroidRuntime(29538):     ... 12 more
09-04 18:09:53.786 E/AndroidRuntime(29547): FATAL EXCEPTION: main
09-04 18:09:53.786 E/AndroidRuntime(29547): java.lang.RuntimeException: Unable to resume activity {com.ilanharitasi/com.facebook.LoginActivity}: java.lang.NullPointerException
09-04 18:09:53.786 E/AndroidRuntime(29547): Caused by: java.lang.NullPointerException
09-04 18:09:53.786 E/AndroidRuntime(29547):     ... 12 more
09-04 18:09:55.516 E/AndroidRuntime(29557): FATAL EXCEPTION: main
09-04 18:09:55.516 E/AndroidRuntime(29557): java.lang.RuntimeException: Unable to resume activity {com.ilanharitasi/com.facebook.LoginActivity}: java.lang.NullPointerException
09-04 18:09:55.516 E/AndroidRuntime(29557): Caused by: java.lang.NullPointerException
09-04 18:09:55.516 E/AndroidRuntime(29557):     ... 12 more
09-04 18:09:57.776 E/AndroidRuntime(29564): FATAL EXCEPTION: main
09-04 18:09:57.776 E/AndroidRuntime(29564): java.lang.RuntimeException: Unable to resume activity {com.ilanharitasi/com.facebook.LoginActivity}: java.lang.NullPointerException
09-04 18:09:57.776 E/AndroidRuntime(29564): Caused by: java.lang.NullPointerException
09-04 18:09:57.776 E/AndroidRuntime(29564):     ... 12 more
09-04 18:09:59.186 E/dalvikvm(29571): Could not find class 'dalvik.system.BaseDexClassLoader', referenced from method com.facebook.common.dextricks.SystemClassLoaderAdder.a
09-04 18:09:59.586 E/dalvik-internals(29571): Failed to look up ladDumpProfiles
09-04 18:09:59.586 E/dalvik-internals(29571): Failed to look up ladResetProfiles
09-04 18:09:59.586 E/dalvik-internals(29571): Failed to look up ladPrintHeaderInfo
09-04 18:09:59.936 E/AndroidRuntime(29578): FATAL EXCEPTION: main
09-04 18:09:59.936 E/AndroidRuntime(29578): java.lang.RuntimeException: Unable to resume activity {com.ilanharitasi/com.facebook.LoginActivity}: java.lang.NullPointerException
09-04 18:09:59.936 E/AndroidRuntime(29578): Caused by: java.lang.NullPointerException
09-04 18:09:59.936 E/AndroidRuntime(29578):     ... 12 more
09-04 18:10:02.006 E/AndroidRuntime(29585): FATAL EXCEPTION: main
09-04 18:10:02.006 E/AndroidRuntime(29585): java.lang.RuntimeException: Unable to resume activity {com.ilanharitasi/com.facebook.LoginActivity}: java.lang.NullPointerException
09-04 18:10:02.006 E/AndroidRuntime(29585): Caused by: java.lang.NullPointerException
09-04 18:10:02.006 E/AndroidRuntime(29585):     ... 12 more
09-04 18:10:04.566 E/ONRESUME(29605): Onresume worked
09-04 18:10:04.636 E/STATEM  (29605): OPENING
09-04 18:10:05.186 E/ONRESUME(29605): Onresume worked


在第一个方面,我可以找我的朋友没有任何错误。它只发生就在我的Facebook连接的第一次,它会询问我的用户名和密码(然后点击登录)


After the first connection, I can find my friends without any error. It only happens just after I connect Facebook for the first time and it asks my username and password(and then clicking Login)

@Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    uiHelper = new UiLifecycleHelper(this, callback);
    uiHelper.onCreate(savedInstanceState);

    setContentView(R.layout.activity_fb_findfriends);
    LinearLayout v = (LinearLayout) findViewById(R.id.fb_app_users);
    openSession(v);

  }

public void openSession(View v){
        // start Facebook Login
        Session.openActiveSession(this, true, callback);

    }

@Override
  protected void onResume() {
      super.onResume();
      uiHelper.onResume();
      Log.e("ONRESUME", "Onresume çalıştı");
  }

private void requestMyAppFacebookFriends(Session session) {
        Request friendsRequest = createRequest(session);
        friendsRequest.setCallback(new Request.Callback() {

            @Override
            public void onCompleted(Response response) {

                List<GraphUser> friends = getResults(response);
                //Display Friends
            }
        });
    friendsRequest.executeAsync();
}

另外,我不明白什么是日志输出空。

Also I couldn't understand what is null from the log output.

更新! 我发现在那里发生错误的行。 它是com.facebook.AuthorizationClient.java线的内侧135

UPDATE! I found the line where error occurs. It is inside the com.facebook.AuthorizationClient.java line 135

void startOrContinueAuth(AuthorizationRequest request) {
        if (appEventsLogger == null || appEventsLogger.getApplicationId() != request.getApplicationId()) {
            Log.e("HATA!", "BOOM");
            appEventsLogger = AppEventsLogger.newLogger(context, request.getApplicationId());
        }

这startOrContinueAuth方法烧制com.Facebook.LoginActivity

And this startOrContinueAuth method is fired in com.Facebook.LoginActivity

@Override
public void onResume() {
    super.onResume();

    // If the calling package is null, this generally means that the callee was started
    // with a launchMode of singleInstance. Unfortunately, Android does not allow a result
    // to be set when the callee is a singleInstance, so we log an error and return.
    if (callingPackage == null) {
        Log.e(TAG, "Aheyy"+NULL_CALLING_PKG_ERROR_MSG);
        finish();
        return;
    }

    authorizationClient.startOrContinueAuth(request);
}
        if (getInProgress()) {
            continueAuth();
        } else {
            authorize(request);
        }
    }

更新2!

  • 我很困惑。我简化了我的应用程序非常基本的 openActiveSession()方法。崩溃
  • 在我试过的脸谱,FriendPicker它还示例应用程序 碰撞与相同的日志错误输出。
  • 在试戴模拟器,它的工作原理,但是当我旋转屏幕时, 授权屏幕显示出来(取消-允许),发生同样的错误(无法 到onResume等等等等...) 得到同样的错误在Facebook上的示例应用程序是怪异
  • I got very confused. I simplified my application to the very basic openActiveSession() method. Crashes
  • I tried sample application of Facebook, FriendPicker and it also crash with the same log error output.
  • tried on emulator, it works but when I rotate the screen when authorization screen shows up(cancel-allow), same error occurs(unable to onResume blah blah...) Getting the same error on Facebook's sample application is weird

推荐答案

我不认为这是一个问题,您的应用程序。人们一直在报道这个错误,我刚才已经回答过类似的问题<一href="http://stackoverflow.com/questions/18752977/app-crashes-after-first-facebook-login/19042059#19042059">here.基本上,Facebook的昨日发布的SDK的新版本修复了onResume NPE坠毁在他们AuthorizationClient。看看升级解决您的问题。

I don't believe that this is an issue with your app. People have been reporting this bug and I just answered a similar question here. Basically Facebook released a new version of their SDK yesterday fixing the onResume NPE crash in their AuthorizationClient. See if upgrading fixes your issue.

这篇关于Android的 - Facebook的登录只对第一次引起onResume错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆