When I upgraded compileSdkVersion 26
& targetSdkVersion 26
to compileSdkVersion 27
& targetSdkVersion 27
in my build.gradle (Module: app) file respectively, it works fine with all other android versions but I encounter the following error in Android 8.0 (API level 26) emulator:
Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
Removing android:screenOrientation="portrait"
worked for me but now my screen is rotating (which I don't want to).
Switching back to compileSdkVersion 26
again works both ways that is I don't get any error and activity screen is also restricted to portrait only.
But my question is to restrict screen orientation to portrait mode only in Android 8.0 (API level 26) while targeting Android Android 8.1 (API level 27).
Any help will be highly appreciated. Thanks.!