skip to Main Content

Android Studio Koala | 2024.1.1 Canary 5

The screen orientation tag in the manifest is deprecated, so I’m seeking an alternative solution.

Gradle plugin version – 8.3.1

android:screenOrientation="portrait"

suppress tool – tools:ignore="DiscouragedApi"

enter image description here

Thanks!

2

Answers


  1. Try setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); in your GetStartedActivity

    Login or Signup to reply.
  2. 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

    Inspection info:The element should not be locked to any orientation so that users can take advantage of the multi-window environments and larger screens available on Android. To fix the issue consider declaring the corresponding activity element with screenOrientation="unspecified"or "fullSensor" attribute.

    enter image description here



    When you declare one of the landscape or portrait values, it is considered a hard requirement for the orientation in which the activity runs. As such, the value you declare enables filtering by services such as Google Play so your application is available only to devices that support the orientation required by your activities.

    In attribution from – https://stackoverflow.com/a/60475542/1761003


    So consider using android:screenOrientation="unspecified" or "fullSensor" in activity allow users utilize application in any orientation especially for Chrome OS devices

    <activity> element should not be fixed specific orientation maximize usability multi-window environments and on larger screens. So resolve this issue update activity element with screenOrientation="unspecified" or "fullSensor" attribute

    Warning is important for not restricting orientation on big-screen devices. If your app is designed for portrait mode only sso you can suppress thus warnings by adding tools:ignore="LockedOrientationActivity" individual activities or top-level <manifest> tag to apply it globally

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

    For further details, refer to:

    If you encounter any unexpected behavior, you can report issue Google Issue Tracker

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search