I am using the StrictMode
in order to find non-SDK usages:
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
In Android P, restrictions have been added to private APIs (that is, APIs that are not part of the public SDK and are accessed via reflection). See Restrictions on non-SDK interfaces:
Android 9 (API level 28) introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are applied whenever an app references a non-SDK interface or attempts to obtain its handle using reflection or JNI. For more information about this decision, see Improving Stability by Reducing Usage of non-SDK Interfaces.
So that's what you're seeing -- it's a warning that something is accessing one of those private APIs that may be removed in the future. However, the stack trace shows, as you mentioned, that this is coming from the WebView
. In particular, during the initialization of SmartSelectionClient. That initializes a native library that implicitly is accessing SmartSelectionEventTracker, which is marked with @hide
in its Javadoc statement, which indicates it is not part of the public SDK.
In short, there's likely nothing you can do about this particular warning, so I wouldn't worry about it. It's happening in the device's Chromium WebView
implementation, so it's outside of your application's control. As both Android and Chromium are published by Google, if there is a legitimate issue in a future release, an update will be published to the WebView
implementation before it becomes a problem.