库清单中的 `android:supportsRtl="true"` 是必需的吗?有时会导致错误

Is `android:supportsRtl="true"` in the Library Manifest essential? It is causing error sometimes

当我创建一个 Android 库时,默认情况下它会在清单文件中给我以下内容

<application android:allowBackup="true"
    android:label="@string/app_name"
    android:supportsRtl="true"/>

在post它作为Bintray上的一个库被其他人使用后,只要意识到包含这个库的应用程序在其Manifest中是否有以下内容

    android:supportsRtl="false"

在gradle同步或编译时会post报如下错误

Error:Execution failed for task ':app:processProductionDebugManifest'.
> Manifest merger failed : Attribute application@supportsRtl value=(false) from AndroidManifest.xml:23:9-36
is also present at [com.mylibrarypackage:mylibrary:1.0.0] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add 'tools:replace="android:supportsRtl"' to <application> element at AndroidManifest.xml:18:5-67:19 to override.

要修复它,我想我需要从我的库清单中删除 android:supportsRtl="true"

只是想知道为什么 Android 将其作为默认库清单?如果我从我的图书馆清单中删除 android:supportsRtl="true" 会不会有任何潜在的问题?

工具:替换=”x,y”

Replace the x, y attributes from any lower priority declaration with the provided value (must be present on the same node).

当导入目标 SDK 低于项目的库时,可能需要明确授予权限(并可能进行其他更改),以便库在以后的运行时正常运行。这将由清单合并自动执行。

您正在获得

Manifest merger failed : Attribute application@supportsRtl value=(false) from AndroidManifest.xml:23:9-36

您可以添加

tools:replace="android:supportsRtl"

终于

<application android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
tools:replace="android:supportsRtl"/>

如果你想支持从右到左 (RTL) 布局,则需要它。 如果设置为 true 且 targetSdkVersion 设置为 17 或更高,系统将激活和使用各种 RTL API,以便您的应用程序可以显示 RTL 布局。如果设置为 false 或者如果 targetSdkVersion 设置为 16 或更低,RTL APIs 将被忽略或无效,并且无论与用户的区域设置相关联的布局方向(您的布局将始终从左到右)。

此属性的默认值为 false。

此属性是在 API 级别 17 中添加的。

(来源:http://developer.android.com/guide/topics/manifest/application-element.html