Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova adds unwanted permission to AndroidManifest.xml when building from CLI

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.

like image 585
mrbay Avatar asked Jul 31 '14 10:07

mrbay


1 Answers

In your project, edit the file plugins/org.apache.cordova.media/plugin.xml You'll see the android specific configuration

   <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="Media" >
                <param name="android-package" value="org.apache.cordova.media.AudioHandler"/>
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.RECORD_AUDIO" />
            <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.READ_PHONE_STATE" />
        </config-file>
...

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.

like image 187
QuickFix Avatar answered Oct 21 '22 18:10

QuickFix