I use CLI to build my Cordova app, and I have added the Media plugin.
'cordova build' automatically adds the android.permission.RECORD_AUDIO to my AndroidManifest.xml even though I don't use that permission.
So how do I remove it? Each time I build to release, the permission is added to the apk.
I have tried the suggestions above (from QuickFix and leuk98743) but the manifest file kept getting re-generated. So I created a hook to modify the manifest file during the build.
hooks/after_prepare/030_remove_permissions.js
In your project, edit the file plugins/org.apache.cordova.media/plugin.xml You'll see the android specific configuration
remove the line
<uses-permission android:name="android.permission.RECORD_AUDIO" />
like this the permission will not be added each time you build.As the permission has already been added to AndroidManifest.xml, you'll have to remove it manually and then it should not come back next time you build.
To keep plugins from re-adding unnecessary permissions edit platforms/android/android.json.
Locate these lines and remove them:
Please note that this is a "dirty" solution. After adding/updating plugins, you'll probably have to repeat this.
after unsuccessfully trying several suggestions ;
went to platforms\android\cordova and ran
went back to project directory and (on windows) ran
opened results.txt to see files with the permission in them
removed mention of permission from all files listed except the AudioHandler.java files.
Did a build and it worked. Finally.