Don’t apply the orientation to the application element, instead you should apply the attribute to the activity element, and you must also set configChanges
as noted below.
Example:
<activity
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden">
</activity>
This is applied in the manifest file AndroidManifest.xml
.