我刚开始使用Android,并使用蓝牙LE在Android Studio中设置了一个API 21项目.
深入了解BluetoothDevice,向我展示了ConnectGatt()方法的两个签名:
public BluetoothGatt connectGatt(Context context, boolean autoConnect,
BluetoothGattCallback callback)
Run Code Online (Sandbox Code Playgroud)
和
public BluetoothGatt connectGatt(Context context, boolean autoConnect,
BluetoothGattCallback callback, int transport)
Run Code Online (Sandbox Code Playgroud)
我想使用第二个,但构建失败:
错误:(127,26)错误:类BluetoothDevice中的方法connectGatt不能应用于给定类型; required:上下文,布尔值,找到BluetoothGattCallback:Context,boolean,BluetoothGattCallback,int reason:实际和形式参数列表的长度不同
似乎编译器设置与Android Studio中的源代码不匹配.
我怎样才能解决这个问题?