facebook + android : Only fullscreen opaque activities can request orientation

后端 未结 6 1875
无人共我
无人共我 2020-12-15 04:12

Facebook SDK version 4.27.0

Android OS version 8.0

App crashes with exception, this is the trace log I have found over Cras

相关标签:
6条回答
  • 2020-12-15 04:36

    Changed

    <style name="AppTheme" parent="android:Theme.Translucent.NoTitleBar"></style>`
    

    to

     <style name="AppTheme" parent="android:Theme.Holo.NoActionBar.TranslucentDecor"></style>
    

    then remove

    <item name="android:windowIsTranslucent">true</item>
    
    0 讨论(0)
  • 2020-12-15 04:40

    In Android O and later this error happens when you set

     android:screenOrientation="portrait"
    

    This code is written in the AndroidManifest file:

    <activity
    android:name="com.google.android.gms.ads.AdActivity"     android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
    android:screenOrientation="portrait"
    android:theme="@android:style/Theme.Translucent"></activity>
    

    Remove this from manifest file

    android:screenOrientation="portrait"
    

    and add below code to activity in oncreate before setContentView :

     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    

    This will fix illegalStateException issue/

    0 讨论(0)
  • 2020-12-15 04:49

    When i removed this <item name="android:windowIsTranslucent">true</item> from style problem was solved.

    0 讨论(0)
  • 2020-12-15 04:50

    From the latest fb integration guide, we don't need to specify either theme or orientation that is causing crash on android 8.0 . So we should use latest fb sdk with their new settings:

    <activity android:name="com.facebook.FacebookActivity"
        android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name" />
    

    https://developers.facebook.com/docs/facebook-login/android/#manifest

    0 讨论(0)
  • 2020-12-15 04:55

    remove this line from your style menu

      <item name="android:windowIsTranslucent">true</item>
    
    0 讨论(0)
  • 2020-12-15 04:56

    Removing this attribute:

    android:screenOrientation="portrait"
    

    from FacebookActivity tag, may solve the problem.

    0 讨论(0)
提交回复
热议问题