Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
476 views
in Technique[技术] by (71.8m points)

android - setContentView is using non-SDK interface

When I run my application in an emulator with the API 28, the console gives me the following warning:

W/oaristachimene: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection) W/oaristachimene: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)

I have been debugging it and I found out that it comes from the call: setContentView(R.layout.activity_main), so is there another way to set the layout of an activity or is this method going to be updated so that it doesn't throws that warning when running on a device with android API 28?.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For the warnings in the question, computeFitSystemWindows and makeOptionalFitsSystemWindows are actually used by the support library or androidx library through reflection. You can verify it by simply searching those two methods in the AppCompatDelegateImpl.

Hopefully this can be fixed later.

Update 1

Recently when I test app in Firebase Test Lab, these 2 APIs and some other APIs are marked

One possible root cause for this warning is Google-owned library UI Toolkit. No action need be taken at this time.

Or

One possible root cause for this warning is Google-owned library Android WebView. No action need be taken at this time.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...