- Home /
how can i merge two android manifest.xml files?
I use two plugins in my project. Both of them have androidmainfest.xml at the same path. Problem accurs. How can I merge them into one? I copy the content here, wish someone can help me. Thanks a lot!!!!!
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/app_id" />
<activity android:name="cn.sharesdk.unity3d.demo.MainActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="cn.sharesdk.framework.ShareSDKUIShell" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter>
<data android:scheme="tencent100371282" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.android.AndroidNativeBridge" android:label="@string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:launchMode="singleTask" android:screenOrientation="portrait" tools:merge="override">
<intent-filter>
***<!--action android:name="android.intent.action.MAIN" /-->***/////////////if I open the sentence here there will be two icons appear after installing our project apk file. But if I leave it like this, the sharing to other platforms function does not work!!!!
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="oauth" android:host="androidnative" />
</intent-filter>
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.LoginActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 855824361110459" />
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<receiver android:name="com.unionassets.android.plugin.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.example.gcm" />
</intent-filter>
</receiver>
<service android:name="com.unionassets.android.plugin.GcmIntentService" />
<activity android:name="com.facebook.LoginActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 395891937214418" />
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
</activity>
<receiver android:exported="true" android:name="com.android.gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="REPLACE_WITH_BUNDLE_IDENTIFIER" />
</intent-filter>
</receiver>
<service android:name="com.android.gcm.GcmIntentService" />
Answer by Get_A123 · May 03, 2014 at 07:55 AM
Declare your manifest header like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
And then add one of the following appropriate attributes to the relevant Activity(s):
tools:merge="override"
tools:merge="remove"
Hi thanks for your answer.But I've tried this method, still not work normally.
In the document of one plugins I found the method, but I still have no idea how can I do as it ordered.
When you build Unity app for android without any plugins, main applicationactivityy class is UnityPlayerActivity. When you using Android Native Plugin it replace UnityPlayerActivity class by AndroidNativeBridge class with is extended from UnityPlayerActivity.
Without plugin: Android App → UnityPlayerActivity With plugin Android App → AndroidNativeBridge → UnityPlayerActivity
With mean is you want to use 2 plugin in you project you have to extend one plugin from another. To have picture like: Android App → AndroidNativeBridge → OtherPlugin → UnityPlayerActivity
or: Android App → OtherPlugin → AndroidNativeBridge → UnityPlayerActivity
To be able to do this you should have at least one plugin with full open source and source eclipse project. Android Native Plugin comes with full open source and eclipse source project.
For example you have another plugin you want to use with Android Native Plugin. Open Android Native Eclipse project. Add Other Plugin jar file to the project Extend AndroidNativeBridge from other plugin Activity class. Rebuild androidnative.jar and replace it in your project
After this step both plugin should work correctly.
Answer by gutentagdesign1 · May 03, 2014 at 09:14 AM
I've found the method, it says:
To be able to do this you should have at least one plugin with full open source and source eclipse project. Android Native Plugin comes with full open source and eclipse source project.
For example you have another plugin you want to use with Android Native Plugin. Open Android Native Eclipse project. Add Other Plugin jar file to the project Extend AndroidNativeBridge from other plugin Activity class. Rebuild androidnative.jar and replace it in your project
After this step both plugin should work correctly.
And I tried to find the jar file: package cn.sharesdk.unity3d.demo;
import android.os.Bundle; import cn.sharesdk.unity3d.ShareSDKUtils; import com.unity3d.player.UnityPlayerActivity;
public class MainActivity extends UnityPlayerActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ShareSDKUtils.prepare(); } }
The shareSDK plugin only supply this jar file no source code. I found out that I can't modify the file above, what should I do then?
Your answer
Follow this Question
Related Questions
Merging 2 AndroidManifest.xml's 1 Answer
How to Merge prime31's manifest xml and vuforia's manifest xml ? 0 Answers
Merge manifest from CYPaySDK with Unity3D 0 Answers
unable to merge androidmenifest 1 Answer
Issue Manifest Merge 2 Answers