In AndroidManifest: Expecting android:screenOrientation="unspecified"

a_subscriber picture a_subscriber · Oct 23, 2019 · Viewed 20.5k times · Source

Android Studio 3.6.

I want my app to be always in portrait mode. So in my AndroidMainfest.xml:

<activity
   android:name=".activity.SplashActivity"
   android:screenOrientation="portrait">
   <intent-filter>
      <action android:name="android.intent.action.MAIN" />

      <category android:name="android.intent.category.LAUNCHER" />
   </intent-filter>
</activity>

I run the app and SplashActivity shows in portrait mode. Nice. But the editor shows the following error:

Expecting android:screenOrientation="unspecified"

Why?

Answer

Darragh MacKenna picture Darragh MacKenna · Feb 25, 2020

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"