Reputation: 395
I'm developing an android app and have made a script that can generate a .xml file dynamically based on certain values. The content it generates are a bunch of <intent-filter>
elements.
After generating the file I want to use android's AndroidManifest-merging to merge it into my main AndroidManifest.xml
The various documentation around the web states, that merging is possible by using different build types/flavors/etc or by having the manifest in its own module (because the manifest in dependencies will always be merged into the main manifest).
The issue is that I dont wan't to use different build types/flavors, I want this file to be merged into AndroidManifest.xml across all build-types. So my idea was:
My questions is whether or not this is actually possible? and if so, where (in the project-structure) do I put my created manifest.xml file and how do I make android merge them?
File-structure of what I have in mind:
- android
| - app
| - src
| - main
| - AndroidManifest.xml (main)
| - someFolderName
| - AndroidManifest.xml (my generated one)
I guess one solution could be to create a separate module for the project, which only contains the AndroidManifest.xml file that I want to merge, but I'm hoping that my initial idea is possible, as it seems simpler and cleaner.
Upvotes: 0
Views: 174
Reputation: 395
The solution to this was to create a separate module/project within the main project. The new module/project should only be responsible for generating the dynamically created xml and writing it to its own AndroidManifest.xml. This will make the app automatically merge all AndroidManifests from sub-modules with the main AndroidManifest.xml when it builds.
Upvotes: 1