I have an annotation processing mechanism which generates android components(activities, services, receivers). I dont know how to inject generated components into apk file.
I tried to edit build/intermediates/merged_manifests/flavour1Debug/Androidmanifest.xml and /build/intermediates/bundle_manifest/flavour1Debug/bundle-manifest/AndroidManifest.xml but unsuccessful. Seems like PackageApplication gradle task ignore intermediate files. Maybe is that because manifest merging task runs before annotation processing task?
One work around is to temporary replace original AndroidManifest.xml file from sources folder and revert changes after build but is a error prone aproach, in case of failure original manifest become broken.
Is there a more elegant solution? Maybe is possible to change tasks order in gradle task graph or maybe I miss something? Maybe is possible to inject generated manifest directly in apk file?