Android 8.0 Only fullscreen opaque activities can request orientation
target_sdk 27 时候调用时出错.应该样式问题, maven里可否修改? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xxx.vp, PID: 12863 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.vp/com.luck.picture.lib.PictureSelectorActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6545) at java.lang.reflect.Method.invoke(Native Method) 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:297) at com.luck.picture.lib.PictureBaseActivity.onCreate(PictureBaseActivity.java:67) at com.luck.picture.lib.PictureSelectorActivity.onCreate(PictureSelectorActivity.java:140) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6545) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 01-15 02:21:46.811 25104-25104/com.vapeam.vp E/AccountInfoTools: getAppid is 0
Same here! java.lang.RuntimeException: Unable to start activity ComponentInfo{*/com.luck.picture.lib.PictureSelectorActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
我也遇到相同的问题 java.lang.RuntimeException:Unable to start activity ComponentInfo{*/com.luck.picture.lib.PictureSelectorActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
@rkaram-sadad I try to import picture_library into my project as module and i modify his styles.xml from <item name="android:windowIsTranslucent">true</item>
into <item name="android:windowIsTranslucent">false</item>
and it works well.
望作者尽快解决8.0的这个报错,修改方式见上
Set Orientation of activity in Manifiest.xml android:screenOrientation="unspecified"
@mastergyp
then what is the replacement of <item name="android:windowIsTranslucent">true</item>
I need this lines of code.
I faced this problem only in SDK 26 (8.0.0) if using windowIsTranslucent 'true' and forcefully setting orientation:
Here's the solution:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
// fixing portrait mode problem for SDK 26 if using windowIsTranslucent = true
if (Build.VERSION.SDK_INT == 26) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
<style name="SplashActivty" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
</style>
I faced this problem only in SDK 26 (8.0.0) if using windowIsTranslucent 'true' and forcefully setting orientation:
Here's the solution:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); // fixing portrait mode problem for SDK 26 if using windowIsTranslucent = true if (Build.VERSION.SDK_INT == 26) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } <style name="SplashActivty" parent="AppTheme"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowNoTitle">true</item> </style>
This does not work, the error occurs when the super.onCreate() is called.
I suggest just remove the orientation script in the manifest.
I faced this problem only in SDK 26 (8.0.0) if using windowIsTranslucent 'true' and forcefully setting orientation: Here's the solution:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); // fixing portrait mode problem for SDK 26 if using windowIsTranslucent = true if (Build.VERSION.SDK_INT == 26) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } <style name="SplashActivty" parent="AppTheme"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowNoTitle">true</item> </style>This does not work, the error occurs when the super.onCreate() is called.
I suggest just remove the orientation script in the manifest.
Set Orientation of activity in Manifiest.xml android:screenOrientation="unspecified"
I resolved this issue by removing android:screenOrientation="portrait" and added below code into my onCreate
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
while my theme properties are
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowDisablePreview">true</item>
I have the same issue but is didn't used windowistransulet = true in my theme