Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
625 views
in Technique[技术] by (71.8m points)

facebook + android : Only fullscreen opaque activities can request orientation

Facebook SDK version 4.27.0

Android OS version 8.0

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

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy/com.facebook.FacebookActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2822)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897)
       at android.app.ActivityThread.-wrap11(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:251)
       at android.app.ActivityThread.main(ActivityThread.java:6563)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
       at android.app.Activity.onCreate(Activity.java:986)
       at android.support.v4.app.SupportActivity.onCreate(SupportActivity.java:66)
       at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:285)
       at com.facebook.FacebookActivity.onCreate(FacebookActivity.java:62)
       at android.app.Activity.performCreate(Activity.java:6975)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897)
       at android.app.ActivityThread.-wrap11(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:251)
       at android.app.ActivityThread.main(ActivityThread.java:6563)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Can anyone help me with this ?

PS: In Android Source, after looking at this line number 987, it seems that this line is the culprit.

https://android.googlesource.com/platform/frameworks/base.git/+/master/core/java/android/app/Activity.java#1002

Also, in my manifest:

<activity
    android:name="com.facebook.FacebookActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name"
    android:screenOrientation="portrait" />
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Removing this attribute:

android:screenOrientation="portrait"

from FacebookActivity tag, may solve the problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...