How to remove specific permission when build Android app with gradle?

Add attribute tools:node with a value of remove to your manifest:

<manifest ... xmlns:tools="http://schemas.android.com/tools">
    ...
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove" />
    ...
</manifest>

See https://developer.android.com/studio/build/manage-manifests#node_markers

Don’t forget to add the tools namespace to the root element of your manifest.

Leave a Comment