Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expecting 'android:screenOrientation="unspecified"' or '"fullSensor"' for this activity

I upgraded my Android Studio to 3.6.0. Now, I get the following error in my Manifest.xml file.

Expecting 'android:screenOrientation="unspecified"' or '"fullSensor"' for this activity so the user can use the application in any orientation and provide a great experience on Chrome OS devices.

Should I convert it to "fullSensor"? How can I get rid of this problem?

Orientation of my activities is portrait. I want to keep using portrait orientation in my activities.

like image 587
Burak Avatar asked Feb 25 '20 14:02

Burak


3 Answers

This is a kind of warning to inform developers that for big screen devices it is not good to restrict the orientation. However if your application only supports portrait mode then this warning can be disabled by doing the following.

Mac: Android Studio -> Preferences

Windows: File -> Settings

Then:

  1. Search for "chrome"
  2. Uncheck "Activity is locked to an orientation"
  3. Apply and ok.

Unchecking step screen shot Unchecking step screen shot for disabling warning

This will only remove the warning for the current system. So this change will not affect the other users working on the same project. They will still see the same warning. In a way, it is good to make this change for the local system as everyone gets to know about this warning. However, if we want to remove this warning at the project level then the following can be used: Add tools:ignore="LockedOrientationActivity" in the manifest tag of your Android Manifest file. For e.g.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="LockedOrientationActivity"

So this is your personal preference, whether you want every developer to be aware of this warning or you want to add the tools:ignore="LockedOrientationActivity" in the manifest and mute this warning for everyone. I prefer to enlight everyone :)

like image 65
Nitesh goyal Avatar answered Nov 10 '22 06:11

Nitesh goyal


Given your application only supports portrait mode, you can ignore these errors by adding tools:ignore="LockedOrientationActivity" to all of your activities or just to the top level <manifest> tag which will apply to all activities.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="LockedOrientationActivity"
    ...
    ...
like image 54
Sohaib Avatar answered Nov 10 '22 07:11

Sohaib


Add this to the manifest tag:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="LockedOrientationActivity"
...
like image 4
Elías S. Peña T. Avatar answered Nov 10 '22 07:11

Elías S. Peña T.