title: java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource
body: <p>Please understand that the question may be a little dizzy because it's my first time asking a question. Also, please understand that grammar may be strange because I am not good at English and use a translator.</p>
  <p>I'm a person who is making apps using java in Android studios.</p>
  <p>There was a continuous error trying to use Bluetooth. There were so many errors that I could easily find a solution, but it didn't apply to me.</p>
  <p><strong>Error Log</strong></p>
  <pre><code>Process: org.techtown.push.bluetoothtest2, PID: 10852
      java.lang.RuntimeException: Unable to start activity ComponentInfo{org.techtown.push.bluetoothtest2/org.techtown.push.bluetoothtest2.MainActivity}: java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource { uid = 10158, packageName = org.techtown.push.bluetoothtest2, attributionTag = null, token = android.os.BinderProxy@f43a396, next = null }: AdapterService getBondedDevices
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3635)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loopOnce(Looper.java:201)
          at android.os.Looper.loop(Looper.java:288)
          at android.app.ActivityThread.main(ActivityThread.java:7839)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
       Caused by: java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource { uid = 10158, packageName = org.techtown.push.bluetoothtest2, attributionTag = null, token = android.os.BinderProxy@f43a396, next = null }: AdapterService getBondedDevices
          at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
          at android.os.Parcel.createException(Parcel.java:2409)
          at android.os.Parcel.readException(Parcel.java:2392)
          at android.os.Parcel.readException(Parcel.java:2334)
          at android.bluetooth.IBluetooth$Stub$Proxy.getBondedDevices(IBluetooth.java:3077)
          at android.bluetooth.BluetoothAdapter.getBondedDevices(BluetoothAdapter.java:2491)
          at org.techtown.push.bluetoothtest2.MainActivity.showPairedDevicesListDialog(MainActivity.java:300)
          at org.techtown.push.bluetoothtest2.MainActivity.onCreate(MainActivity.java:80)
          at android.app.Activity.performCreate(Activity.java:8051)
          at android.app.Activity.performCreate(Activity.java:8031)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792) 
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210) 
          at android.os.Handler.dispatchMessage(Handler.java:106) 
          at android.os.Looper.loopOnce(Looper.java:201) 
          at android.os.Looper.loop(Looper.java:288) 
          at android.app.ActivityThread.main(ActivityThread.java:7839) 
          at java.lang.reflect.Method.invoke(Native Method) 
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
  </code></pre>
  <p>I think this sentence in the middle is the cause of the error.</p>
  <pre><code>Caused by: java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource { uid = 10158, packageName = org.techtown.push.bluetoothtest2, attributionTag = null, token = android.os.BinderProxy@f43a396, next = null }: AdapterService getBondedDevices
  </code></pre>
  <p>But I've already applied a solution to the problem. This is my Manifest.xml.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;org.techtown.push.bluetoothtest2&quot;&gt;
  
      &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH_ADMIN&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH_SCAN&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH_ADVERTISE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH_CONNECT&quot; /&gt;
      &lt;uses-feature android:name=&quot;android.hardware.bluetooth&quot; android:required=&quot;false&quot;/&gt;
      &lt;uses-feature android:name=&quot;android.hardware.bluetooth_le&quot; android:required=&quot;false&quot;/&gt;
  
      &lt;application
          android:allowBackup=&quot;true&quot;
          android:icon=&quot;@mipmap/ic_launcher&quot;
          android:label=&quot;@string/app_name&quot;
          android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
          android:supportsRtl=&quot;true&quot;
          android:theme=&quot;@style/Theme.Bluetoothtest2&quot;&gt;
          &lt;activity
              android:name=&quot;.MainActivity&quot;
              android:exported=&quot;true&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  <p>I applied it because I saw that I needed &quot;android.permission.BLUETOOTH_CONNECT permission.&quot; However, errors continue to occur.</p>
  <p>Am I misunderstanding something? Or did I make a mistake in mainactivty.java?</p>
  <p>For your information, I made it like this when I made a project.</p>
  <blockquote>
  <p>minimun sdk : API 16 : Android 4.1 (Jelly Bean)</p>
  </blockquote>
  <p>If there is no problem with the file you wrote down, please tell me to review the Java code again.
  Thank you.</p>