How to merge multiple AndroidManifest.xml files??

Hello!, i need help i have been stuck for about a week with this, i used multiple plugins on a proyect and those plugins uses the AndroidManifest.xml, so when i import a plugin it overwrites the old AndroidManifest, so i have picked all of them individually and im looking a way to merge them all.

The plugins im using are:

  • Google Play OBB Downloader
  • Everyplay
  • Mobile Social Plugin
  • GameAnalytics Unity Package
  • Qualcomm Vuforia

Yeah i know thats a lot of plugins, i have tried merging the files manually but i dont really know how it works so the new merged AndroidManifest didnt work, i have been investigating and i think it has to do with the < intent-filter >, from what i have read it should be only one < activity > with the < intent-filter > on the entire < application >.

Im not even sure that if merging those files the way i did its the right way to do it, i need someone to point me in the right direction.

Im uploading here all the manifests and the one i created merging all those, if you need more information or another file just tell me and i will upload it or give the information needed, Thank You! :slight_smile:

[28319-manifests.zip|28319]

To answer this, i can generally say that there may be scenarios where multiple AndroidManifests.xml will be OK, and there will be times where it won’t.

The only rule is that there’s no general solution for making it work (if any, at all).

Your claim regarding multiple activities in a single manifest is wrong, as you can see in some of the attached files, where multiple elements are defined.

Unity claims to perform some merging of provided AndroidManifests (e.g: the main one under Plugins/Android will be merged with others that are placed in subfolders of Plugins/Android) - quoted from here: Unity - Manual: Create and use plug-ins in Android

The issue is that each plugin defines its own Activity that should be the LAUNCHER activity (the “entry point” to the app), and so multiple plugins will not be able to co-exist.

So, for this scenario, there’s no easy solution.

I would try to do the following:

  1. Double check to see if i really need that many plugins?
  2. Verify with the plugin developer if there’s a version or option to not use the manifest and their activity ?
  3. Following #2, check if there’s an option to manually initialize the plugin code, and if so, create my own custom activity that will do the initialization (skipping the need for the plugin to have its own activity).

Hello, i managed to merge two plugins who used the actions “android.intent.action.MAIN” and “android.intent.category.LAUNCHER” (that is the main conflict, you can have any number of activities but just only one with those two actions) so here is what i did.

The plugins i merged where Mobile Social Plugin and the Vuforia plugin.

I mailed the developer of the Mobile Social Plugin (wich i recommend) asking for advice, he told me that i should recompile the .jar file but include all other plugins there.
In the same package of the plguin there is a .zip called “ANEclipseProject.zip” where the entire Eclipse proyect was located.

I needed Eclipse so i downloaded Eclipse for Android from here AndroidSDK+Eclipse i created a new Eclipse proyect and added the files i got from the zip, then i added the .jar files of the Vuforia plugin (“QCARUnityPlayer.jar” and “Vuforia.jar” to be exact).

Now you have to find how its called the main script, to do this i looked in the manifest how it was called the Activity that wanted the actions MAIN and LAUNCHER, in the Mobile Social Plugin its called “AndroidNativeBridge” find that file in the proyect and open it.

Now you have to find how its named the other plugin activity that wants the actions MAIN and LAUNCHER, for example for vuforia its named “QCARPlayerNativeActivity”, what you should do now is extend the file you opened before (AndroidNativeBridge) to the class “QCARPlayerNativeActivity” (before this the file should be extending “UnityPlayerActivity”), dont forget to add the “import com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity;” to the import list to be detected correctly. (the complete name can be seen on the manifest)

Then Eclipse automatically recompiles itself, you can find the .jar in the folder “bin” inside the Eclipse proyect with the name “androidnative.jar” and this file its what you need to overwrite in your proyect, find the file inside unity and replace it with your new .jar.

Now all you need to do is adjust the manifest to include all the activities and permissions of both of the plugins, and in the secondary plugin activities delete the lines where tries to use the actions MAIN and LAUNCHER.

So basically what you need is the Eclipse proyect of one of the plugins and include the jar files of the other plugins, extend the main activity to them and adjust the manifest to include all the atcivities.

Here is the links that was given to me where i got the information about merging the two plugins.
https://docs.google.com/document/d/1px0BVXcZqgrW99OQV4bM7q1rD5NYaCYTxXnn4eS4ytY/edit#heading=h.7frodoz468gu
https://docs.google.com/document/d/1px0BVXcZqgrW99OQV4bM7q1rD5NYaCYTxXnn4eS4ytY/edit#heading=h.284j90a89lo8
https://docs.google.com/document/d/1px0BVXcZqgrW99OQV4bM7q1rD5NYaCYTxXnn4eS4ytY/edit#heading=h.66wnkolqt5dq

I hope this helps, you can ask me if you have any question, im not an expert but i will try to help. :slight_smile:

Hello everyone,

This may be coming late, but it can help other people out there to solve the issue of using two or more plugin in your unity android project. Most especially Vuforia and any other plugin. I had spend many days, weeks, and not able to combine the androidmanifest.xml of the two plugins. All of the credits go to this great guy (https://forum.unity.com/members/eppz.665736/). He made a very detailed tutorial on how to use multiple plugin in your project. All you have to do is first read carefully, identify the exact files and edit the exact lines. The link to the tutorial is http://eppz.eu/blog/unity-android-plugin-tutorial-1/ , you can also ask me any question and I can help you as much as I can.

Thanks everyone.