gpt4 book ai didi

Android list 合并 : removing LAUNCHER intent-filter doesn't take effect

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:34:16 27 4
gpt4 key购买 nike

在我的 android 应用程序中,我使用了一个库项目,并且我使用了其中的一个 Activity 。但是在图书馆项目中,该 Activity 具有 MAIN 操作和 LAUNCHER 类别 intent-filter。所以我将该 Activity 添加到我的 list 中并删除了 intent-filter。 list 似乎已正确合并到 build/intermediates/manifests/full/debug/AndroidManifest.xml 中,并且 Activity 看起来符合预期(没有 intent-filter):

    <activity
android:name="com.michaelrnovak.util.logger.Logger"
android:configChanges="orientation"
android:label="@string/show_log" >
</activity>

但是,当我在模拟器中从 AndroidStudio 启动应用程序时,将启动库的 Logger Activity ,而不是我的 AlertsActivity。我做错了什么?

这是库的 list :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.michaelrnovak.util.logger"
android:versionCode="8"
android:versionName="1.5">
<uses-permission android:name="android.permission.READ_LOGS" />
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity android:name=".Logger"
android:label="@string/app_name"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
<uses-sdk android:minSdkVersion="7" />
</manifest>

我的应用程序 list 具有以下相关 Activity 定义:

    <activity
android:name=".AlertsActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
</activity>
<activity android:name="com.michaelrnovak.util.logger.Logger"
android:label="@string/show_log"
android:configChanges="orientation"
tools:replace="android:label"
>
<intent-filter tools:node="removeAll" />
</activity>

最佳答案

您是否仅在类别节点上尝试过 tools:node="remove"?根据我的经验,它似乎有效。

像这样:

<activity android:name="com.michaelrnovak.util.logger.Logger"
android:label="@string/show_log"
android:configChanges="orientation"
tools:replace="android:label"
>
<intent-filter>
<category tools:node="remove" android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

关于Android list 合并 : removing LAUNCHER intent-filter doesn't take effect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31262389/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com