-
-
Notifications
You must be signed in to change notification settings - Fork 902
Description
🐛 Bug Report
I only want to test whether Bluetooth is turned on or off (with flutter_blue_plus
), therefore I would assume that only <uses-permission android:name="android.permission.BLUETOOTH"/>
would be sufficient.
However, when I request Bluetooth permission I get D/permissions_handler(27550): Bluetooth permission missing in manifest
.
The same is true when there is no uses-permission
entry at all.
Setting the line twice like this however works:
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
This only happens in combination with flutter_blue_plus
, but since the error message is reported by this plugin I wanted to start here.
I actually can request the bluetooth state even without the permission at all on my device (android 12) but I guess it's necessary on older devices.
The problem with adding the permission twice is that Google Play refuses to accept the AABs.
Expected behaviour
Requesting/getting the permission result without error messages.
Reproduction steps
I created a small reproducing project here.
In the AndroidManifest.xml
the Bluetooth permission is only added once, which leads to the error above.
Configuration
Phone: Pixel 5 with Android 12
Version: 10.0.0
Platform:
- 📱 iOS🤖 AndroidTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Activity
florissmit1 commentedon Aug 5, 2022
Android 12's permission handling has changed, so the
<uses-permission android:name="android.permission.bluetooth>
must be changed, the permission is only used for devices which target API level 30 and lower. You can read more about it here; https://developer.android.com/guide/topics/connectivity/bluetooth/permissions.I think this should be changed in the documentation of the permission handler, since the documentation is still targeting Android 11 and lower.
c15yi commentedon Aug 5, 2022
Since my use case is only to check whether bluetooth is turned on or off, I actually don't need any bluetooth permission at all on no android device.
The documentation says that the
android.permissions.BLUETOOTH
permission is only to connect to paired devices (not really what I needed anyways).In the end on Android I can safely ignore the Bluetooth permission handling.
But regarding the behaviour of the library it's still strange, that there is that error message.
Even when I add these permissions
it still shows me this error message:
D/permissions_handler(17875): Bluetooth permission missing in manifest
I updated the example repo with this for you to check.
Erhannis commentedon Aug 17, 2022
I've encountered a similar problem, but with bluetooth AND location. After duplicating the
BLUETOOTH
permission, I got an error "No permissions found in manifest for: []3", which number, looking at the code, maps to the location group. I then duplicated my existing location permissions, and the app then successfully asked for permissions and ran correctly. This is pretty clearly a bug in something; having the permissions present once should be sufficient, and having them present MORE than once should do nothing.Permissions:
Request code:
Android 12
Flutter 3.3.0-0.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 7ac27ac8e6 (2 weeks ago) • 2022-08-02 14:35:08 -0700
Engine • revision d1e7dc18bf
Tools • Dart 2.18.0 (build 2.18.0-271.4.beta) • DevTools 2.15.0
benjaminpaik commentedon Dec 25, 2022
I've been struggling the the exact same issue with
flutter_blue_plus
for the last few days. I stumbled across your post and tried duplicating the bluetooth permission in the manifest and it worked. Another odd thing about this is that I was previously using the originalflutter_blue
and didn't have any manifest issues even though I didn't duplicate the permission.c15yi commentedon Jan 11, 2023
@benjaminpaik, if I remember correctly there were issues with release builds when having the permission set twice in the manifest. So that is not really a workaround.
appano1 commentedon Jan 30, 2023
In my case I got same error before flutter 3.7.0.
After updating flutter version to 3.7.0, the error disappeared.. 😂
benjaminpaik commentedon Jan 31, 2023
@appano1 Hmm. I just tried upgrading to flutter 3.7.0 as well and I still have permission issues.
appano1 commentedon Jan 31, 2023
@benjaminpaik Try this..!
flutter: 3.7.0
permission_handler: ^10.0.2
AndroidManifest.xml
in your dart file
benjaminpaik commentedon Feb 1, 2023
@appano1 Thanks for replying.
That's basically how I have it, but it still only works if I add BLUETOOTH permissions twice.
albertmoravec commentedon Feb 3, 2023
Duplicating the
BLUETOOTH
permission worked for me as well.Couldn't it be that the first occurrence gets merged with another library's definition with
maxSdkVersion
version set and then the second occurrence is left as is?My working merged
AndroidManifest.xml
looks like this:I suspect that
permission_handler
is requiring manifest entries that aren't really necessary and fails with theBluetooth permission missing in manifest
message even though everything should work.Fix android bluetooth permission request above api version 30
Fix android bluetooth permission request above api version 30
Fix android bluetooth permission request above api version 30
Fix android bluetooth permission request above api version 30
myselfuser1 commentedon Mar 17, 2023
This might help https://www.youtube.com/watch?v=uMvGpBOT0ZY
C-8 commentedon Jun 21, 2023
Adding bluetooth permission twice is not working anymore. It throws error:
Element uses-permission#android.permission.BLUETOOTH at AndroidManifest.xml:6:3-66 duplicated with element declared at AndroidManifest.xml:3:3-5:36
DevTiago commentedon Nov 18, 2023
Any update on this issue?
alexxgarci commentedon Nov 21, 2023
@C-8 any workaround on this?
benjaminpaik commentedon Dec 11, 2023
I just tested my old project upgrading to Flutter 3.16.3 and permission_handler 11.1.0. Adding BLUETOOTH to the manifest twice still works for me. Perhaps it was broken and then fixed in a recent update.
PhillipMahlke-flour commentedon May 15, 2025
Can we get this pr merged, if it fixes this problem?
While adding the permissions twice does work, Google Play Store does not allow this workaround and prevents the appbundle to be released, if it has the bluetooth permissions twice.
Should not be marked as P2, if it literally prevents publishing of apps. Should be marked as P0