元数据中的 EnableSafeBrowsing 的 Lint 警告“此处不允许使用元素元数据”

Pet*_*ter 1 android lint android-manifest

我已在清单文件中添加了 EnableSafeBrowsing。这基于此处提供的信息: https: //android-developers.googleblog.com/2017/06/whats-new-in-webview-security.html

当我在我的应用程序上运行 Lint 分析时,我在此 Manifest 语句中收到以下警告:(Element meta-data is not allowed here此检查突出显示 Android 资源文件和 AndroidManifest.xml 中不允许的 XML 标记)

<meta-data
        android:name="android.webkit.WebView.EnableSafeBrowsing"
        android:value="true" />
Run Code Online (Sandbox Code Playgroud)

此时我正在压制这个警告(<!--suppress AndroidElementNotAllowed --> )。有没有关于 Lint 是否或何时不再将其视为警告的消息?

在清单中的位置:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.xxxxx.xxxxxx">

    <!--suppress AndroidElementNotAllowed -->
    <meta-data
        android:name="android.webkit.WebView.EnableSafeBrowsing"
        android:value="true" /> 
Run Code Online (Sandbox Code Playgroud)

Zoe*_*Zoe 7

将其添加到应用程序标签中。如果您阅读文档meta-data,您将看到该标签可以包含在的标签列表:

<activity>
<activity-alias>
<application>
<provider>
<receiver>
<service> 
Run Code Online (Sandbox Code Playgroud)

这意味着它不允许作为manifest标签的子代。把它放在下面application标签下。

您链接的博客有错误的信息,该信息也得到了安全浏览文档的支持- 这个特定的元数据位于应用程序标签下