Manifest merging issue where a library has a required feature


(Josh Wilson) #1

I work on an application that has a few different libraries. One of these provides scanning of barcodes for our application. In our manifest we have the following lines:

<uses-feature
    android:name="android.hardware.camera"
    android:required="false"/>
<uses-feature
    android:name="android.hardware.camera.autofocus"
    android:required="false"/>

In our application we do checking to see if the device supports these features before we let the user proceed with barcode scanning. This allows us to support devices that may not have either a camera or a camera that has autofocus.

Unfortunately when Gradle merges the Manifests from the libraries we use with our application’s Manifest these uses-feature tags have their required set to true. Our only solution so far is to edit the library manifest to set the feature to not required.

The Application’s manifest should override any settings in library manifests. We want to keep providing support to devices without auto-focus and/or without camera’s.