Ok, a few things to look at here. Normally you’d use < addPermission /> for this, but it copies all the attributes exactly into a < use-permission /> tag if the name isn’t already in the manifest. Since you want a string replacement this won’t work, but there is another way to do this using element variables to make up the element.
The second issue is your way of getting the package name will work only if an exact package name is entered and doesn’t use the [PROJECT] replacement. We can work around this as well by reading the package attribute from the manifest instead. This needs to be in the < androidManifestUpdates /> section, not < init />.
I’ve looked at the message and the ‘manifest’ missing is a bug; it wrote the tag instead of the name in this case. The actual error is it didn’t find ‘mypermission’ as an element variable. This is due to the parse failing for a few reasons. The first issue is the < and > needed to be < and >. The second is with the android:name not having android defined in the element. There is a way around this by using the < addAttribute /> since I deal with the namespace there. I just tried this and it works: