合并android清单文件,冲突过滤器

我正在尝试在Unity中组合来自2个插件的安卓清单文件,但有两个活动使用相同的intent-filter,我只能同时获得1个或另一个….

在两个冲突的活动中,清单文件中最顶层的活动是可行的活动.因此,如果清单#1中的活动位于顶部,插件#1将起作用,但不起作用#2,反之亦然.

这两个相互冲突的活动是:

<activity
        android:name="com.devfo.andutils.DevfoUnityPlayerActivity"
        android:label="@string/app_name"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
        android:screenorientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
    </activity>

和:

<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity" 
android:label="@string/app_name" android:screenorientation="portrait" 
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

有什么方法可以合并这两个并让他们从同一个应用程序工作?我正在使用Unity 3d.

解决方法

例如,在您只想将第一个活动用作启动器的清单中,您必须添加以下两个修改

在清单的开头:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

对于要删除intent过滤器的活动,请添加以下代码

<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity" 
android:label="@string/app_name" android:screenorientation="portrait" 
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
  <intent-filter tools:node="removeAll">
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

重要的是在intent-filter标记添加工具:node =“removeAll”属性

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...