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
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>
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/
When i removed this <item name="android:windowIsTranslucent">true</item>
from style problem was solved.
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
remove this line from your style menu
<item name="android:windowIsTranslucent">true</item>
Removing this attribute:
android:screenOrientation="portrait"
from FacebookActivity
tag, may solve the problem.