Android L Developer Preview packages missing?

雨燕双飞 提交于 2020-01-07 02:29:10

问题


I'm trying to use the Android L Developer Preview SDK, specifically the Bluetooth Low Energy classes. I set compileSdkVersion 'android-L', minSdkVersion 'L', and targetSdkVersion 'L'. I can see the L platform SDK under "External Libraries", but when I go to see what is inside the android.jar, the android.bluetooth.le package is missing. Thus, I cannot use any of the Bluetooth LE classes such as BluetoothLeScanner and ScanCallback. Does anyone know how to fix this?


回答1:


I would guess this is a bug in Android Studio (there are some other APIs for which this has been reported too)...

If you write something like:

BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
android.bluetooth.le.BluetoothLeScanner scanner = adapter.getBluetoothLeScanner();

then this is indeed reported as an error in Android Studio. However, it does build ok when using gradlew build.

In short, you can use it, but it's really awkward. I hope this will be fixed soon.




回答2:


It must've been an Android Studio bug, I updated to 0.8.2 and the problem went away!



来源:https://stackoverflow.com/questions/24643083/android-l-developer-preview-packages-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!