设置"requried = false"时仍需要蓝牙LE

rwo*_*cik 2 android bluetooth android-manifest android-gradle-plugin

我已将我的清单设置为使用蓝牙低能耗功能,我希望它是可选的,但当我尝试更新Google Play商店中的应用时,它说我仍然需要BTLE功能,它会削减我的设备范围.

我添加了android:required="false"param,但它仍然无法正常工作.

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

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

<uses-feature
        android:name="android.hardware.bluetooth_le"
        android:required="false"/>
Run Code Online (Sandbox Code Playgroud)

我的aapt转储徽章:

uses-feature-not-required: name='android.hardware.bluetooth'
uses-feature: name='android.hardware.bluetooth_le'
uses-feature: name='android.hardware.camera'
uses-feature-not-required: name='android.hardware.camera.autofocus'
uses-feature-not-required: name='android.hardware.camera.flash'
uses-feature-not-required: name='android.hardware.nfc'
uses-feature: name='android.hardware.screen.landscape'
uses-feature-not-required: name='android.hardware.touchscreen'
uses-feature-not-required: name='android.hardware.wifi'
uses-feature: name='android.hardware.screen.portrait'
Run Code Online (Sandbox Code Playgroud)

在正常的蓝牙功能上它可以工作,但在BTLE它没有.我正在使用Estimote SDK.

gio*_*gio 7

您的应用使用Estimote SDK.库已根据需要声明了功能.

Manifest Merger工具的官方网站

<uses-feature android:required> - 默认为true.与其他属性合并将使用OR合并策略,因为如果任何库需要该功能,则生成的应用程序将需要该功能.

解决方案是使用<tools:node="replace">工具:节点标志

用带注释的声明替换低优先级声明.

你明显将是下一个:

<manifest
    package="com.tivogi.so"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

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

    <uses-feature
        android:name="android.hardware.bluetooth"
        android:required="false"
        tools:node="replace" />

    <uses-feature
        android:name="android.hardware.bluetooth_le"
        android:required="false"
        tools:node="replace" />
   ....
</manifest>
Run Code Online (Sandbox Code Playgroud)