什么是工具的用法:targetApi =“m”?

问题描述 投票:1回答:1

我有一个应用程序使用clearText在Android客户端和服务器之间使用Retrofit,在Android 9+它不允许使用clearText

要忽略我在android:usesCleartextTraffic="true"中添加了Manifest,但它警告:tools:ignore="GoogleAppIndexingWarning"并建议添加tools:targetApi="m"

这有点令人困惑:

  • tools:targetApi="m"是否意味着tools:的任何属性都是棉花糖和更高?
  • 是使用这个版本的Manifest还是别的什么?这是否会在我的应用中犯下不必要的错

我的清单:

...
<application
    android:name=".ApplicationClass"
    android:allowBackup="true"
    android:fullBackupContent="false"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="false"
    android:theme="@style/AppTheme.NoActionBar"
    android:usesCleartextTraffic="true"
    tools:ignore="GoogleAppIndexingWarning"
    tools:targetApi="m">
    ...
android namespaces attributes android-manifest manifest
1个回答
2
投票

docs你可以阅读:

表示Lint应将此类型视为针对给定API级别,无论项目目标是什么

这意味着它只会影响带注释的一个。

tools的其他属性不会受到影响。 tools是一个命名空间,从中可以获取属性,一个属性不会影响整个命名空间。

© www.soinside.com 2019 - 2024. All rights reserved.