30

I have an app that is targeting Android 9 and I noticed in the Google Play prelaunch report a new section called Android compatibility. This new section lists warnings or errors related to the usage of unsupported APIs. The following is one of the problems and is listed as a greylisted API. Can someone explain which is the unsupported API in this case? The usage seems to be coming from the Android support library and not my 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 android.support.v7.widget.ViewUtils.makeOptionalFitsSystemWindows(ViewUtils.java:84)
    at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:685)
    at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
    at android.support.v7.app.AppCompatDelegateImpl.onPostCreate(AppCompatDelegateImpl.java:299)
    at android.support.v7.app.AppCompatActivity.onPostCreate(AppCompatActivity.java:98)
    at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1342)
    at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3002)
    at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
    at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
a.p.
  • 3,248
  • 7
  • 30
  • 48
  • 1
    possibly duplicate, check out [here](https://stackoverflow.com/questions/9780934/finding-what-violated-strictmode-policy) – Mehul Solanki May 14 '19 at 12:31
  • 1
    https://stackoverflow.com/questions/9780934/finding-what-violated-strictmode-policy – IntelliJ Amiya May 14 '19 at 12:31
  • 7
    I do not think it is the same problem. The warning I have (note that it is a warning - I do not have any app crashes) is for a NonSdkApiUsedViolation- this is not the same as a StrictModeDiskReadViolation due to disk performing disk operations on the main thread. The warning comes up on the Google Play vitals section. – a.p. May 14 '19 at 15:16
  • 1
    I have faced the same problem any solution you found till now...?? – Ahmad Joyia May 14 '19 at 22:41

1 Answers1

13

I suppose there nothing we can do right now, just to wait that they fixed these issues in AndroidX (as Support Library won't be updated anymore).
As mentioned here the methods use reflection, so why the warning.

Jérémy Reynaud
  • 3,020
  • 1
  • 24
  • 36