其他分享
首页 > 其他分享> > 图书馆清单中的`android:supportsRtl =“true”`必不可少?它有时会导致错误

图书馆清单中的`android:supportsRtl =“true”`必不可少?它有时会导致错误

作者:互联网

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

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

在将其作为Bintray上的库发布并被其他人使用之后,只需了解包含此库的应用程序是否在其清单中具有以下内容

    android:supportsRtl="false"

它将在gradle sync或编译期间发布如下错误.

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.

要修复它,我想我需要从我的库Manifest中删除android:supportsRtl =“true”.

只是想知道为什么Android将此默认为库清单?如果我从我的库Manifest中删除android:supportsRtl =“true”,会不会有任何潜在的问题?

解决方法:

工具:replace =“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"/>

标签:android,android-library,android-manifest
来源: https://codeday.me/bug/20191006/1862701.html