Flutter BLE scan fails on Android 12 and newer because of BLUETOOTH_SCAN
BLUETOOTH_SCAN permission deniedShort answer
Android 12 split Bluetooth into three permissions. A scan needs BLUETOOTH_SCAN declared in AndroidManifest.xml and also granted by the user at runtime, because it is a runtime permission. The old BLUETOOTH and location entries only apply to Android 11 and lower. Declare the new ones, request them in Dart, then scan again.
Fix it fast
1Find out which cause you have
Open the merged manifest of the built app and check which Bluetooth permissions actually ended up in it. A plugin or an old template line can differ from what you wrote.
grep -n -i "bluetooth\|location" android/app/src/main/AndroidManifest.xml2Match what you see, then jump to its fix
- 1
The app targets Android 12 (API 31) or higher but only lists BLUETOOTH, BLUETOOTH_ADMIN and location permissionsBLUETOOTH_SCAN is not declared in the manifestFix - 2
The manifest is right, no Nearby devices dialog ever appears, and the scan is deniedThe permission is declared but never requested at runtimeFix - 3
Scanning is allowed but a specific beacon or sensor never shows upLocation is still required, or neverForLocation hides the deviceFix
- 1
What does the error look like?
BLUETOOTH_SCAN permission deniedScan returns an empty list on Android 12 and newer
Cause 1 of 3
BLUETOOTH_SCAN is not declared in the manifest
1Check
Android's documentation says an app that targets API 31 or higher must declare BLUETOOTH_SCAN if it looks for Bluetooth devices. Look for that line in your manifest.
grep -n "BLUETOOTH_SCAN" android/app/src/main/AndroidManifest.xml2Fix
Add the Android 12 permissions, and cap the legacy ones at API 30 so newer phones do not get them.
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />3Verify
Rebuild so the manifest is merged again, then start a scan on an Android 12+ device.
flutter run -d <device-id>Confirmed by developer.android.com
Cause 2 of 3
The permission is declared but never requested at runtime
1Check
BLUETOOTH_SCAN, BLUETOOTH_CONNECT and BLUETOOTH_ADVERTISE are runtime permissions. The user must approve them in a dialog before you scan, connect or advertise. Search your Dart code for the request call.
grep -rn "Permission\.\|requestPermissions" lib/2Fix
Ask for BLUETOOTH_SCAN and BLUETOOTH_CONNECT in Dart before the first scan, using the runtime-permission API of the plugin you already use. The exact permission names come from that plugin's documentation. Handle a denied answer in the UI.
# no shell command: add the runtime request in Dart, before calling startScan()3Verify
Uninstall the app so the old decision is cleared, run it again and accept the Nearby devices dialog.
adb uninstall com.example.myapp && flutter runConfirmed by developer.android.com
Cause 3 of 3
Location is still required, or neverForLocation hides the device
1Check
If you set neverForLocation on BLUETOOTH_SCAN, Android's documentation warns that some BLE beacons are filtered out of the scan results. If your app derives location from scans, you need ACCESS_FINE_LOCATION instead.
grep -n "neverForLocation\|ACCESS_FINE_LOCATION" android/app/src/main/AndroidManifest.xml2Fix
Keep neverForLocation only if you never use scan results for location. Otherwise remove it and declare ACCESS_FINE_LOCATION without a maxSdkVersion limit.
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />3Verify
Rebuild, grant the permissions again and check that the missing device now appears.
flutter run -d <device-id>Confirmed by developer.android.com
How do I stop it coming back?
- Declare permissions for the newest Android target and use maxSdkVersion for the legacy ones, as Android's Bluetooth guide shows.
- Request Bluetooth permissions in one place, before the first scan, and handle a denied answer in the UI.
- Test on one Android 11 or lower device and one Android 12 or higher device, because the two permission sets differ.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
Related fixes
Mobile apps
Google Play says the app does not support 16 KB memory pages
check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a
Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.
5 causes, each with a fixMobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
Gradle cannot create LibraryVariantBuilderImpl in a Flutter Android build
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl
This error appears when the Android Gradle plugin (AGP) cannot run in the Gradle or IDE you use.
3 causes, each with a fixMobile apps
Flutter release build cannot open the keystore: HmacPBESHA256 not available
Algorithm HmacPBESHA256 not available
The keystore is a PKCS12 file protected by a newer algorithm than the Java that is reading it understands.
3 causes, each with a fixMobile apps
Android install error: the package conflicts with an existing package of the same name
The package conflicts with an existing package by the same name
Android allows only one app per application ID, and an update must be signed with the same certificate as the installed version.
3 causes, each with a fixMobile apps
Android resource linking fails with resource android:attr/lStar not found
error: failed linking references.
The lStar attribute exists only from Android API 31.
2 causes, each with a fix