代码之家  ›  专栏  ›  技术社区  ›  Mahdi Moqadasi

有什么用工具:targetApi=“m”?

  •  0
  • Mahdi Moqadasi  · 技术社区  · 7 年前

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

    忽略我添加的 android:usesCleartextTraffic="true" 在里面 Manifest 但它警告说: tools:ignore="GoogleAppIndexingWarning" 并建议添加 tools:targetApi="m" .

    有点困惑:

    • 工具:targetApi=“米” 意思是任何属性 tools: 是给棉花糖的吗?

    • 是用这个版本的清单还是别的什么?这是不是在我的应用程序中犯了不必要的错误?

    我的清单:

    ...
    <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">
        ...
    
    0 回复  |  直到 7 年前
        1
  •  6
  •   Luca Nicoletti    7 年前

    docs 您可以阅读:

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

    这意味着它将影响 只有 有注解的那个。

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

    推荐文章