我开发了一个允许用户使用他们的Facebook帐户登录的应用程序。
上周工作正常。
当用户尝试使用Facebook登录时,当设备上安装了Facebook应用程序时,它会崩溃。
如果没有安装Facebook应用程序,它可以正常工作。
为什么会这样? facebook最近改变了他们的API吗?
我认为这个问题与最近的lolipop升级有关,强迫意图明确。这是由堆栈跟踪
支持的堆栈追踪:
java.lang.RuntimeException: Unable to resume activity {com.google/com.facebook.LoginActivity}: java.lang.IllegalArgumentException: **Service Intent must be explicit: Intent** { act=com.facebook.platform.PLATFORM_SERVICE cat=[android.intent.category.DEFAULT] }
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2958)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2989)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2372)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5274)
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:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.facebook.platform.PLATFORM_SERVICE cat=[android.intent.category.DEFAULT] }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1745)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1844)
at android.app.ContextImpl.bindService(ContextImpl.java:1822)
at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
at com.facebook.GetTokenClient.start(GetTokenClient.java:62)
at com.facebook.AuthorizationClient$GetTokenAuthHandler.tryAuthorize(AuthorizationClient.java:535)
at com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:214)
at com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:193)
at com.facebook.AuthorizationClient.authorize(AuthorizationClient.java:121)
at com.facebook.AuthorizationClient.startOrContinueAuth(AuthorizationClient.java:102)
at com.facebook.LoginActivity.onResume(LoginActivity.java:113)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1241)
at android.app.Activity.performResume(Activity.java:6063)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2947)
... 11 more
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.facebook.platform.PLATFORM_SERVICE cat=[android.intent.category.DEFAULT] }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1745)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1844)
at android.app.ContextImpl.bindService(ContextImpl.java:1822)
at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
at com.facebook.GetTokenClient.start(GetTokenClient.java:62)
at com.facebook.AuthorizationClient$GetTokenAuthHandler.tryAuthorize(AuthorizationClient.java:535)
at com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:214)
at com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:193)
at com.facebook.AuthorizationClient.authorize(AuthorizationClient.java:121)
at com.facebook.AuthorizationClient.startOrContinueAuth(AuthorizationClient.java:102)
at com.facebook.LoginActivity.onResume(LoginActivity.java:113)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1241)
at android.app.Activity.performResume(Activity.java:6063)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2947)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2989)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2372)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5274)
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:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Log Cat:
java.lang.InternalError: Thread starting during runtime shutdown
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:1063)
at org.apache.http.impl.conn.tsccm.AbstractConnPool.enableConnectionGC(AbstractConnPool.java:140)
at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.createConnectionPool(ThreadSafeClientConnManager.java:120)
at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>(ThreadSafeClientConnManager.java:98)
at org.acra.util.HttpRequest.getHttpClient(HttpRequest.java:214)
at org.acra.util.HttpRequest.send(HttpRequest.java:141)
at org.acra.sender.HttpSender.send(HttpSender.java:225)
at org.acra.SendWorker.sendCrashReport(SendWorker.java:179)
at org.acra.SendWorker.checkAndSendReports(SendWorker.java:141)
at org.acra.SendWorker.run(SendWorker.java:77)
这是实际代码
public void loginFacebook(){
Session session = new Session(context);
Session.setActiveSession(session);
Session.OpenRequest openRequest = null;
if (fragment != null) {
openRequest = new Session.OpenRequest(fragment);
} else if (context instanceof Activity) {
openRequest = new Session.OpenRequest((Activity)context);
}
if (openRequest != null) {
openRequest.setDefaultAudience(SessionDefaultAudience.FRIENDS);
openRequest.setPermissions(Arrays.asList("email", "user_birthday"));
openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK);
session.openForRead(openRequest);
}
}
我怀疑是因为这个而发生的
https://developers.facebook.com/blog/post/2015/04/28/april-30-migration/
--------- beginning of main
05-13 22:16:52.708 I/SensorManager( 5740): registerListenerImpl() [Sensor: LGE Orientation Sensor, Rate: 200000, SensorEventListener: com.google.MySensorManager$1@6c83602] bycom.google.MySensorManager.getSensor():43
05-13 22:16:56.140 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:16:56.204 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:16:56.217 I/SensorManager( 5740): removeAllSensors() [Sensor: LGE Orientation Sensor] bycom.google.MySensorManager.unregisterListener():132
05-13 22:16:56.379 I/SensorManager( 5740): registerListenerImpl() [Sensor: LGE Orientation Sensor, Rate: 200000, SensorEventListener: com.google.MySensorManager$1@28004a85] bycom.google.MySensorManager.getSensor():43
05-13 22:16:56.407 D/URL ( 5740): http://www.listaboutplaces.com/ocr/Catalog/api/v2/GetCatalog.ashx?keyword=&distance=5000&lat=-7.2757458&long=112.7833469&howmany=20&startfrom=0&maxbiz=5&deviceid=196c72a543837635&latitude=-7.2757458&longitude=112.7833469&tk=35fad0d79639371225369f3466dd7603
05-13 22:16:56.419 I/CliptrayUtils( 5740): CliptrayUtils created!! mTextView = android.widget.EditText{2032f839 VFED..C. ......I. 0,0-0,0 #7f0700e8 app:id/editSearchBar}
05-13 22:16:56.435 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:16:56.438 I/CliptrayUtils( 5740): CliptrayUtils created!! mTextView = android.widget.EditText{cf3b718 VFED..C. ......I. 0,0-0,0 #7f0700e8 app:id/editSearchBar}
05-13 22:16:56.466 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:16:56.466 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:16:56.466 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:16:56.466 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:16:58.127 I/art ( 5740): Background sticky concurrent mark sweep GC freed 7(128B) AllocSpace objects, 0(0B) LOS objects, 0% free, 94MB/94MB, paused 5.004ms total 14.012ms
05-13 22:16:59.314 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:16:59.465 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:16:59.652 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:16:59.836 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:16:59.836 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: DOWN vectorVelocity:2271 signal:1
05-13 22:17:00.538 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:00.635 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:17:00.646 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:00.646 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-6690 signal:-1
05-13 22:17:00.725 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:00.917 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:01.232 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:01.907 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:01.985 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:01.985 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-8157 signal:-1
05-13 22:17:02.243 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:02.423 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:02.615 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:03.285 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:03.365 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:03.365 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-5929 signal:-1
05-13 22:17:04.646 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:04.734 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:04.735 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-5980 signal:-1
05-13 22:17:05.132 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:05.340 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:05.841 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:05.841 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-3063 signal:-1
05-13 22:17:05.845 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:17:06.439 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:06.561 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:06.561 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-4992 signal:-1
05-13 22:17:07.248 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:08.719 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:08.839 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:08.839 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-4422 signal:-1
05-13 22:17:09.039 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:09.208 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:09.208 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: DOWN vectorVelocity:1292 signal:1
05-13 22:17:10.676 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:10.903 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:15.809 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:15.959 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:17:15.960 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:15.960 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-3968 signal:-1
05-13 22:17:16.738 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:16.832 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:16.832 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-4285 signal:-1
05-13 22:17:17.419 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:17.509 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:17.609 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:17.609 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-6129 signal:-1
05-13 22:17:18.316 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:18.708 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:19.461 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:20.378 D/skia ( 5740): --- SkImageDecoder::Factory returned null
05-13 22:17:20.723 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:20.831 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:20.831 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-5394 signal:-1
05-13 22:17:22.509 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:22.725 D/URL ( 5740): http://www.listaboutplaces.com/ocr/Catalog/api/v2/GetCatalog.ashx?keyword=&distance=5000&lat=-7.2757458&long=112.7833469&howmany=20&startfrom=20&maxbiz=5&deviceid=196c72a543837635&latitude=-7.2757458&longitude=112.7833469&tk=35fad0d79639371225369f3466dd7603
05-13 22:17:22.728 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:22.728 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:-520 signal:-1
05-13 22:17:23.210 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:23.368 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:23.368 W/TouchFlickNoti( 5740): CAPP_TOUCH_FLICK: UP vectorVelocity:0 signal:0
05-13 22:17:24.518 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:24.604 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:24.611 I/SensorManager( 5740): removeAllSensors() [Sensor: LGE Orientation Sensor] bycom.google.MySensorManager.unregisterListener():132
05-13 22:17:24.617 D/BubblePopupHelper( 5740): isShowingBubblePopup : false
05-13 22:17:26.218 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:26.309 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:27.223 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:27.313 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:28.054 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:28.119 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:29.771 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_DOWN
05-13 22:17:29.818 I/ViewRootImpl( 5740): ViewRoot's Touch Event : ACTION_UP
05-13 22:17:29.841 I/Timeline( 5740): Timeline: Activity_launch_request id:com.google time:30161984
05-13 22:17:29.875 D/ContextHelper( 5740): convertTheme. context->name=com.google themeResourceId=2131492978
05-13 22:17:29.911 D/AndroidRuntime( 5740): Shutting down VM
05-13 22:17:29.918 E/ACRA ( 5740): ACRA caught a RuntimeException exception for com.google. Building report.
05-13 22:17:29.918 D/ACRA ( 5740): Using custom Report Fields
05-13 22:17:29.954 I/ACRA ( 5740): READ_LOGS granted! ACRA can include LogCat and DropBox data.
05-13 22:17:30.010 D/ACRA ( 5740): Retrieving logcat output...