alhazmy13 / MediaPicker

Media Picker is an Android Libary that lets you to select multiple images or video
alhazmy13.net
Apache License 2.0
268 stars 86 forks source link

Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation #85

Closed NerdFaisal404 closed 5 years ago

NerdFaisal404 commented 5 years ago

(net.alhazmy13.mediapicker.Video.VideoActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2830) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2909) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1606) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6592) 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:769) Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation at android.app.Activity.onCreate(Activity.java:991) at android.support.v4.app.SupportActivity.onCreate(SupportActivity.java:66) at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:321) at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84) at net.alhazmy13.mediapicker.Video.VideoActivity.onCreate(VideoActivity.java:54) at android.app.Activity.performCreate(Activity.java:6984)

RobiOxx commented 5 years ago

+1

khantthulinn commented 5 years ago

anyone can fix?

HBiSoft commented 5 years ago

This probably happens because you have android:screenOrientation="portrait" or android:screenOrientation="landscape" declared for your Activity in your manifest.

Remove it and use the following in your Activity class instead:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

or

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Hesamedin commented 5 years ago

@HBiSoft I just tested your idea but din't work. The app is still crashing even after removing those settings from the manifest file.

HBiSoft commented 5 years ago

@Hasemedin have a look at this - https://stackoverflow.com/a/52964692/5550161

Hesamedin commented 5 years ago

@HBiSoft, thanks for the link. The problem is the crash Happens in the Lib side. Therefore, the change in my activity doesn't prevent the fix (because crash is not because of my activity).

I found that something has changed in the new version that fixes the issue. I was using the lib version 2.4.0. After upgrading to the latest version 2.4.4 then my app didn't crash.