4

After finding out that my old code which was using appcompat is being deprecated because they are replacing appcompat with androidx, I converted my code over to using androidx... but I'm still getting some NonSdkApiUsedViolations in my Google Play Pre-launch report, and they are IN the AndroidX code!

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredMethodInternal(Native Method)
    at java.lang.Class.getPublicMethodRecursive(Class.java:2075)
    at java.lang.Class.getMethod(Class.java:2063)
    at java.lang.Class.getMethod(Class.java:1690)
    at androidx.appcompat.widget.ViewUtils.makeOptionalFitsSystemWindows(ViewUtils.java:84)
    at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:685)
    at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
    at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
    at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
    at com.domain.myapp.HelpActivity_.setContentView(HelpActivity_.java:48)
    at com.domain.myapp.HelpActivity.onCreate(HelpActivity.java:92)

I thought maybe something in my layout might be triggering it, but I don't see anything that should:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rootView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    >

    <ImageView
        android:id="@+id/watermark"
        android:src="@drawable/question_mark_watermark"
        android:gravity="end|bottom"
    />

    <RelativeLayout
        android:id="@+id/switchcontainer"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:background="@color/help"
        android:layout_alignParentTop="true"

        >

        <TextView
            android:id="@+id/switchlabel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:text="@string/view_tutorials_as"
            android:layout_alignParentStart="true"
            android:layout_centerVertical="true"
            android:textColor="#fff"
            />

        <Switch
            android:id="@+id/switchForActionBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginEnd="20dp"
            android:layout_marginStart="20dp"
            android:layout_marginTop="2dp"
            android:layout_toEndOf="@id/switchlabel"
            android:checked="true"
            android:fadeScrollbars="false"
            android:gravity="center_vertical"
            android:showText="true"
            android:switchPadding="20dp"
            android:switchTextAppearance="@style/Help.SwitchText"
            android:textOff="@string/text"
            android:textOn="@string/videos"
            android:thumb="@drawable/apptheme_switch_inner_holo_light"
            android:track="@drawable/apptheme_switch_track_holo_light"
            />

    </RelativeLayout>

    <ListView
        android:id="@+id/tableView"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:layout_below="@id/switchcontainer"
        android:cacheColorHint="#00000000"
        android:divider="#ccc"
        android:dividerHeight="1dp"
    />

</RelativeLayout>
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
  • i could be wrong, but i doubt this is related to a layout file, could you maybe post your build.gradle? are you using any dependencies ? – a_local_nobody Aug 10 '19 at 16:51
  • Check out [this question](https://stackoverflow.com/questions/52358496/setcontentview-is-using-non-sdk-interface). It looks like it's a known issue in the `androidX` library – esentsov Aug 10 '19 at 18:48

0 Answers0