FacebookActivity 未在 Api 上调用 finish() 23+

FacebookActivity did not call finish() on Api 23+

我在我的应用程序中使用 facebook sdk。为了在点击 facebook 按钮时不显示单人进度条,我使用:

<activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:theme="@android:style/Theme.NoDisplay"
</activity>

但是,我认为对于 api 23+ 的设备,这会导致崩溃:

"com.facebook.FacebookActivity did not call finish() prior to onResume() completing"

有人在这里说: 通过写作:

@Override
protected void onStart() {
    super.onStart();
    setVisible(true);
}

在有问题的 activity 中,他们解决了问题。但是由于我无法编辑 FacebookActivity,有没有其他解决方案?

参见 windowNoDisplay 的 javadoc:

(...)your activity must immediately quit without waiting for user interaction(...)

所以异常是正确的,您的用例不匹配 windowNoDisplay

这是平台错误。

If you have been using Theme.NoDisplay in one or more activities in your app, and you have not tested them on Android 6.0 yet, I recommend that you do so soon. An undocumented regression in Android 6.0 will cause some of those activities to crash upon launch, if your targetSdkVersion is 23 or higher.

查看此博客 post:https://commonsware.com/blog/2015/11/02/psa-android-6p0-theme.nodisplay-regression.html

Facebook 已更改其 instructions 用于初始设置您的项目。只需将 com.facebook.FacebookActivity 的主题更改为 @android:style/Theme.Translucent.NoTitleBar