如何解决Android清单合并:与其他声明无关的警告
我检查了与该主题相关的大量类似帖子,但没有能够指出我面临的问题。
因此,基本上我有一个具有启动器活动的模块,但我不想通过覆盖主模块的启动器活动来成为主启动器。因此,我使用了节点tools:node="remove"
来删除它。示例:
主应用程序的清单: ...
<activity
android:name="path.ThatOneActivity"
android:screenorientation="locked"
android:theme="@style/AppCompatTheme.Translucent.NoTitleBar">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<Meta-data
android:name="nextActivity"
android:value="path.ThatOtherActivity" />
</activity>
我的模块的清单:
<activity
android:name="path.ThatOneActivity"
android:screenorientation="locked"
android:theme="@style/AppCompatTheme.Translucent.NoTitleBar"
tools:node="merge">
<intent-filter tools:node="remove">
<action
android:name="android.intent.action.MAIN"
tools:node="remove" />
<category
android:name="android.intent.category.LAUNCHER"
tools:node="remove" />
</intent-filter>
<Meta-data
android:name="nextActivity"
android:value="path.ThatOtherActivity" />
</activity>
因此,正如您所看到的,这实际上是在不同线程上的多个解决方案的混合,但它不起作用。 (是的,甚至不是个别的。)
然后我在构建时检查了日志,发现了一个警告:
category#android.intent.category.LAUNCHER was tagged at AndroidManifest.xml: to remove other declarations but no other declaration present
这现在令人困惑,因为我不确定这意味着什么。与其他线程一样,我也确实添加了xmlns:tools
,但没有任何反应:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="my.borning.app">
更新:
按照CommonsWare的注释进行更改:
<activity android:name="path.ThatOneActivity">
<intent-filter>
<action
android:name="android.intent.action.MAIN"
tools:node="remove" />
<category
android:name="android.intent.category.LAUNCHER"
tools:node="remove" />
</intent-filter>
</activity>
,但仍收到警告:
category#android.intent.category.LAUNCHER was tagged at AndroidManifest.xml: to remove other declarations but no other declaration present
我还是想出一件事: 我正在开发一个由主应用程序使用的模块(该模块也不由我管理,我的模块是一个之前出错的库。因此,这与Priority有关!我是试图覆盖的库)是将我的模块用作库的主应用程序的启动器。是否可以通过库覆盖启动器(基本上是可以提高Manifest的优先级,这听起来不太可能)?
如果您可以指导我具体的方向,将会很有帮助。让我知道是否需要更多详细信息。
提前谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。