Ionic/Cordova not building AndroidManifest correctly (causing 505 error in Lollipop)


The issue appears to be a change in Android OS since rev 5.0 (Lollipop) combined with what appears to be a bug in Ionic/Cordova.

Android uses a key for permissions and as of 5.0 this key must be unique for each app installed on the device. Ionic uses settings defined in the AndroidManifext.xml to define this key. When we build the
Android APK this manifest file is rebuilt and it SHOULD create these keys based on the application id which is assigned in the config.xml file. Within the manifest file we can see other places where the
manifest is built correctly and uses the app id listed in the config.xml file; but it doesn’t do this for the permissions key.

NOTE: we have a platform for creating multiple apps where we only change config.xml and the resource files prior to building a new APK. So we do not want to remove/add platform for each app.

The result is that we end up with all our apps using the same permissions key; which as of rev 5.0 means only 1 app from MMA can be installed at a time on the device.

Temporary solution:
Every time we switch to build a new app we need to remove the android platform and re-add it before building. This causes manifest to be rebuilt completely using the config.xml.

Better solution:
Since its a pita to remove/add platform this is likely not the correct solution. Either Ionic needs to be fixed or possibly we have a template file configured incorrectly.

Does anyone know if there is a template file used to build the AndroidManifest that can be modified to be properly changed when the APK is built?