Ensuring maximum required permissions during Android manifest merging for location/bluetooth permissions

Viewed 36

I have a modular codebase. One of my modules needs to always request ACCESS_FINE_LOCATION

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Another module only needs to request this permission up to SDK level 30.

<uses-permission
    android:name="android.permission.ACCESS_FINE_LOCATION"
    android:maxSdkVersion="30" />

If I build an app which includes both of those modules, I would expect the merged manifest to contain.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

However, it shows up with maxSdkVersion="30". This seems like incorrect/unexpected merging behavior.

How can I fix this?

Background info: one module uses Bluetooth permissions simply to connect to Bluetooth devices; the other uses it to scan for Bluetooth beacons, thus requiring ACCESS_FINE_LOCATION irregardless of SDK level.

0 Answers
Related