So since Unity 5 we’ve been able to put our Android Native plugins anywhere in the project, they were not limited to existing in the “Plugins/Android” folder. However, while writing a native Android plugin the Android Manifest file was not merging upon build unless that Android Manifest file existed specifically in “Assets/Plugins/Android” folder. Is this still a requirement? Is there a bug? I’ve looked for documentation or other posts and I was not able to find the answer.
First of all, you should understand that the final .apk package has only a single (1) AndroidManifest in it.
All the AndroidManifest.xml files in your libraries (.aar or “Andriod library” project) in the Unity project are getting merged together at build time into a single manifest.
An Android library project is a folder structure (should be under Assets/Plugins/Android) that has the following:
- project.properties file at its root
- AndroidManifest.xml at its root
- libs/ folder with library (native JARs or .aar) dependencies
- bin/ folder with compiled java classes
- res/ resources with any needed Android resources
Not all folders are required of course, but the first 2 are a must.
Here’s an example screenshot of such a folder structure:
You don’t have to place your manifest under Assets/Plugins/Android anymore.