In AndroidManifest: Expecting android:screenOrientation="unspecified"
In your manifest tag (just under xmlns:android="http://schemas.android.com/apk/res/android"
), put
xmlns:tools="http://schemas.android.com/tools"
Then inside the application tag, put
tools:ignore="LockedOrientationActivity"
it only affects Android Studio 3.6+
What is the Issue here? This issue occurs because android framework wants user to control the app orientation himself it is not advised to restrict your app orientation for example if a user wants to use the app in landscape orientation he just flips the device and sensors will do the work but when a developer restrict screen orientation, even when rotation sensor works app will stay in pre-defined state, in a way you are restricting user's device capabilities.
What to do now? You have two options., First is to ignore the error as it won't cause any build failure even I am doing the same and apk/aab generation is as usual Another Option is to provide Landscape Layouts or to handle the rotation like in some apps which recognize if orientation gets changed they will prompt the user to change the orientation as the app is not supported in such orientation
It may change in future => at present it is not effecting our build process but it might change in future
In Android studio 3.6.0 i guess they want the user to handle the orientation and encourage developer to use ViewModel stuff. Let me explain screenOrientation in detail
android:screenOrientation="portrait"
will give you error you have to either specify
android:screenOrientation="fullSensor" or android:screenOrientation="unspecified"
fullSensor Means either you have ON the "Rotate off" or not it will change the orientation based on you move the phone
unspecified Means if you have ON the Rotate off then it will stay only in that orientation and if not then it will change the orientation based on you move the phone.
Add following line after android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity"
Then click Alt+Enter