库清单中的"android:supportsRtl ="true""是否必不可少?有时会导致错误 [英] Is `android:supportsRtl="true"` in the Library Manifest essential? It is causing error sometimes

查看:447
本文介绍了库清单中的"android:supportsRtl ="true""是否必不可少?有时会导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建Android库时,默认情况下,它将在清单文件中显示以下内容

When I create an Android library, by default it would give me the below in the Manifest file

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

将其发布为Bintray上的库并被其他人使用后,只要意识到包含此库的应用程序的清单中是否包含以下内容即可

After post it as a library on Bintray and used by others, just realise if an application that include this library has the below in its Manifest

    android:supportsRtl="false"

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

It will post the error as below during gradle sync or compilation.

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".

To fix it, I think I would need to remove the android:supportsRtl="true" from my library Manifest.

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

Just wonder why did Android have this as default its library manifest? Would there be any potential problem if I remove android:supportsRtl="true" from my library Manifest?

推荐答案

tools:replace =" x,y"

将任何优先级较低的声明中的x,y属性替换为 提供的值(必须存在于同一节点上).

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

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

When importing a library with a lower target SDK than the project’s, it may be necessary to explicitly grant permissions (and perhaps make other changes) for the library to function properly in the later runtime. This will be performed automatically by the manifest merger.

你正在得到

清单合并失败:属性application @ supportsRtl value =(false)来自AndroidManifest.xml:23:9-36

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:supportsRtl ="true""是否必不可少?有时会导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆