6

Unity の 2 つのプラグインから Android マニフェスト ファイルを結合しようとしていますが、同じインテント フィルターを持つ 2 つのアクティビティがあり、同時に動作させることができるのはどちらか一方だけです....

競合する 2 つのアクティビティのうち、マニフェスト ファイルで一番上にある方が機能します。したがって、マニフェスト #1 からのアクティビティが最上位にある場合、プラグイン #1 は機能しますが #2 は機能しません。

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>

2つをマージして同じアプリから動作させる方法はありますか? Unity 3d を使用しています。

4

5 に答える 5

6

たとえば、最初のアクティビティのみをランチャーとして使用するマニフェストでは、次の 2 つの変更を追加する必要があります。

マニフェストの冒頭:

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

そして、インテント フィルターを削除するアクティビティに対して、次のコードを追加します。

<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 タグにtools:node="removeAll"属性を追加することです

于 2015-01-26T14:53:29.003 に答える
2

@amarkovitsの回答とは少し異なりますが、次の方法で成功しました。

<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"
          tools:node="merge">
            <intent-filter tools:node="remove"> ...

最初にそれをマージしようとし、次にランチャー画面に両方のアイコンを引き起こすインテントフィルターだけを置き換えると私は信じています

于 2015-04-28T22:51:58.607 に答える