I can successfully connect to facebook and get a list of friends. All connections are OK. But when I delete the Facebook data (via settings-> Applications) and my application, I have a login problem. [SDK 3.5]
- Launch the application
- Make facebook connection
- Facebook asks for a username and password, enters them
- Wait a bit
- A permissions screen is displayed here, asking for basic user information, and an error occurs: "Your application stops working unexpectedly. Try again (FORCE CLOSE)"
When I click the Force Close button, the same error occurs over and over again suddenly (while the resolution screen is still behind). If I can be fast enough, I click Force Close and then Allow Permission, everything is going well and I can see my friends. So this FORCE CLOSE error means something like nothing? There are 3-4 identical Fatal Exception messages in the log, because every time I press FORCE CLOSE, the error occurs again. This error occurs when trying to application on my phone (SE Xperia Arc S, 2.3.3). But when I try to use emulators, an error does not occur. It works without a problem. (emulators 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
After the first connection, I can find my friends without any errors. This only happens after I first connected to Facebook and it asks for my username and password (and then click "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 could not figure out what is null from the log output.
UPDATE! I found the line where the error occurs. It is inside the line com.facebook.AuthorizationClient.java 135
void startOrContinueAuth(AuthorizationRequest request) { if (appEventsLogger == null || appEventsLogger.getApplicationId() != request.getApplicationId()) { Log.e("HATA!", "BOOM"); appEventsLogger = AppEventsLogger.newLogger(context, request.getApplicationId()); }
And this startOrContinueAuth method is launched 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); } }
UPDATE 2!
- I was very embarrassed. I simplified my application to the most basic openActiveSession () method. Crashes
- I tried a sample Facebook application, FriendPicker, and it also crashes with the same log error output.
- I tried the emulator, it works, but when I rotate the screen, when the authorization screen appears (cancel-allow), the same error (fails to onResume blah blah ...) Getting the same error in the application for the Facebook example is strange.