简体   繁体   English

在 android studio java.lang.SecurityException 中查找错误:需要 android.permission.BLUETOOTH_CONNECT

[英]Finding Error in android studio java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT

I am new to Android studio.我是 Android 工作室的新手。 I am trying to connect to brother label printer QL-820NMB with the new Android APK (SDK 31) with android version 12 and the device is also android 12 itself.我正在尝试使用新的 Android APK(SDK 31)和 android 版本 12 连接到兄弟 label 打印机 QL-820NMB,并且该设备本身也是 android 12。 I tried pairing the device it gets paired.我尝试配对它配对的设备。 But when I tried to access the paired devices in the code finding the error in the line但是当我尝试访问代码中的配对设备时发现行中的错误

Set<BluetoothDevice> pairedDevices = BluetoothAdapter.getBondedDevices();

And Exception is...例外是...

System.err: java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource { uid = 0000, packageName = com.xyz.xyz, attributionTag = null, token = android.os.xyz, next = null }: AdapterService getBondedDevices

I have provided all the manifest for permissions.我已经提供了所有权限清单。

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

and also updated the mobile updates recommended and also updated the BrotherPrintLibrary jar to aar as recommended file.还更新了推荐的移动更新,并将 BrotherPrintLibrary jar 更新为 aar 作为推荐文件。

But still unable to access the Bluetooth and getting the same Security Exception as above is there any solution or can I know am I missing any configuration issue in the mobile or the code.但仍然无法访问蓝牙并获得与上述相同的安全异常是否有任何解决方案,或者我可以知道我是否遗漏了移动设备或代码中的任何配置问题。

I forgot to mention the same APK is working fine in Android 7 device but not in Android 12.我忘了说同一个 APK 在 Android 7 设备上运行良好,但在 Android 12 设备上运行良好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.SecurityException:需要 android.permission.BLUETOOTH_CONNECT 权限以获得 AttributionSource - java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource java.lang.SecurityException:需要 BLUETOOTH 权限:用户 10065 和当前进程都没有 android.permission.BLUETOOTH - java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10065 nor current process has android.permission.BLUETOOTH Java.lang.SecurityException:Android中的安全权限? - Java.lang.SecurityException:SECURE PERMISSION in android? Android 工作室 java.lang.SecurityException:需要 INSTALL_LOCATION_PROVIDER 权限 - Android studio java.lang.SecurityException: need INSTALL_LOCATION_PROVIDER permission java.lang.SecurityException:UID 10457 / PID 24525 缺少权限 android.permission.BLUETOOTH - java.lang.SecurityException: UID 10457 / PID 24525 lacks permission android.permission.BLUETOOTH Android:java.lang.SecurityException - Android: java.lang.SecurityException Android GoogleMaps在某些设备上不工作,显示java.lang.SecurityException:需要INSTALL_LOCATION_PROVIDER权限 - Android GoogleMaps not working on some devices shows java.lang.SecurityException: need INSTALL_LOCATION_PROVIDER permission java.lang.SecurityException:权限拒绝错误 - java.lang.SecurityException: Permission Denial ERROR Android棒棒糖java.lang.SecurityException:用户和当前进程都没有android.permission.BLUETOOTH_PRIVILEGED - Android lollipop java.lang.SecurityException: Neither user nor current process has android.permission.BLUETOOTH_PRIVILEGED 使用StatusBarManagerService时出错 - 在android.permission.STATUS_BAR_SERVICE上使用java.lang.SecurityException - Error using StatusBarManagerService - java.lang.SecurityException on android.permission.STATUS_BAR_SERVICE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM