E / BluetoothAdapter (883): связыватель Bluetooth не установлен
ANSWER: Как использовать Bluetooth в эмуляторе Android? Я попытался включить disable bluetooth-устройство. По этой причине я написал ниже код, но он дает ошибку, которая также находится ниже.
if ( bluetoothAdmin == null ) < return ; >if ( bluetooth . isEnabled()) < bluetooth . disable (); >else
BLuetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter() ;
01-23 07:18:53.167: E/BluetoothAdapter(883): Bluetooth binder is null
01-23 07:36:55.624: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 01-23 07:37:16.954: E/ActivityThread(642): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d51230 that was originally bound here 01-23 07:37:16.954: E/ActivityThread(642): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d51230 that was originally bound here 01-23 07:37:16.954: E/ActivityThread(642): at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:969) 01-23 07:37:16.954: E/ActivityThread(642): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 01-23 07:37:16.954: E/ActivityThread(642): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 01-23 07:37:16.954: E/ActivityThread(642): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 01-23 07:37:16.954: E/ActivityThread(642): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:11 6) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 01-23 07:37:16.954: E/ActivityThread(642): at android.os.AsyncTask$2.call(AsyncTask.java:287) 01-23 07:37:16.954: E/ActivityThread(642): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 01-23 07:37:16.954: E/ActivityThread(642): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 01-23 07:37:16.954: E/ActivityThread(642): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 01-23 07:37:16.954: E/ActivityThread(642): at java.lang.Thread.run(Thread.java:856) 01-23 07:37:16.964: E/StrictMode(642): null 01-23 07:37:16.964: E/StrictMode(642): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.Servi[email protected] that was originally bound here
Откуда эта ошибка? У вас есть полный стек, показывающий линию? Вы прочитали полный Javadoc для включения ()? (что очень полно с некоторыми очень важными советами)
Возможно, я слепой, но я не вижу сообщения об ошибке в стеке . Связь между этим стеком и вашей проблемой даже не ясна .
@Orabîg Orabîg sometmes единственная ошибка в стеке — первая. Большая часть стека времени дает последние ошибки. Код правильный?
E/BluetoothAdapter(883): Bluetooth binder is null
ANSWER:How to use Bluetooth in Android emulator? I have tried to enable disable bluetooth device. For this reason, I have wrote below code but it gives the error, which is also at below.
if ( bluetoothAdmin == null ) < return ; >if ( bluetooth . isEnabled()) < bluetooth . disable (); >else
BLuetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter() ;
01-23 07:18:53.167: E/BluetoothAdapter(883): Bluetooth binder is null
01-23 07:36:55.624: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 01-23 07:37:16.954: E/ActivityThread(642): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d51230 that was originally bound here 01-23 07:37:16.954: E/ActivityThread(642): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d51230 that was originally bound here 01-23 07:37:16.954: E/ActivityThread(642): at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:969) 01-23 07:37:16.954: E/ActivityThread(642): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 01-23 07:37:16.954: E/ActivityThread(642): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 01-23 07:37:16.954: E/ActivityThread(642): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 01-23 07:37:16.954: E/ActivityThread(642): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:11 6) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 01-23 07:37:16.954: E/ActivityThread(642): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 01-23 07:37:16.954: E/ActivityThread(642): at android.os.AsyncTask$2.call(AsyncTask.java:287) 01-23 07:37:16.954: E/ActivityThread(642): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 01-23 07:37:16.954: E/ActivityThread(642): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 01-23 07:37:16.954: E/ActivityThread(642): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 01-23 07:37:16.954: E/ActivityThread(642): at java.lang.Thread.run(Thread.java:856) 01-23 07:37:16.964: E/StrictMode(642): null 01-23 07:37:16.964: E/StrictMode(642): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d51230 that was originally bound here
Can’t get bluetooth Adapter in Android
I was trying to implement the bluetooth chat example given in the android samples. I am running it on a jelly beans device which has Android 4.1 version running on it . The application simply force closes. A part of launcher activity code of launcher activity goes like this. WHEN I COMMENT THE LINE «mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();» THE APPLICATION DOES NOT FORCE CLOSE. and all the toast messages are also displayed which are not with the line uncommented
private BluetoothAdapter mBluetoothAdapter = null; // Member object for the chat services private BluetoothChatService mChatService = null; @Override public void onCreate(Bundle savedInstanceState) < super.onCreate(savedInstanceState); Toast.makeText(getApplicationContext(),"BluetothChat oncreate()", Toast.LENGTH_LONG).show(); if(D) Log.e(TAG, "+++ ON CREATE +++"); // Set up the window layout setContentView(R.layout.main); // Get local Bluetooth adapter try < mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); //>// If the adapter is null, then Bluetooth is not supported if (mBluetoothAdapter == null) < Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); finish(); return; >> catch (Exception e) < Toast.makeText(this,e.toString(), Toast.LENGTH_LONG).show(); >> @Override public void onStart() < Toast.makeText(getApplicationContext(),"BluetothChat onstart()", Toast.LENGTH_LONG).show(); super.onStart(); if(D) Log.e(TAG, "++ ON START ++"); // If BT is not on, request that it be enabled. // setupChat() will then be called during onActivityResult try < if (!mBluetoothAdapter.isEnabled()) < Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableIntent, REQUEST_ENABLE_BT); // Otherwise, setup the chat session >else < if (mChatService == null) < setupChat(); >> > catch (Exception e) < Toast.makeText(this,e.toString(), Toast.LENGTH_LONG).show(); >>
How to use Bluetooth in Android emulator?
the adapter is returning null value, which means the android emulator is not having bluetooth capability. i am using android 2.1 the latest version of android.Anybody knows how to use the bluetooth from android emulator, please help me.
8 Answers 8
You can’t. The emulator does not support Bluetooth, as mentioned in the SDK’s docs and on several other places.
And you already discovered this yourself: «the adapter is returning null value, which means the android emulator is not having bluetooth capability»
You can install the image from http://www.android-x86.org/ into a virtual machine (e.g. VMWare), find out it’s IP address, connect manually using
And then launch your project from Eclipse by setting a «Manual» deployment target in your Debug/Run configuration. Bluetooth works in this Virtual Machine at least on my Macbook and it’s reported to work with a couple of other bluetooth chipsets.
If you have a USB dongle and ensure that it’s passed through and connected to the virtual machine, I’d assume it works, yes.
It’s not possible to run bluetooth aap on emulator.as there is no support for bluetooth on emulator. look at this http://developer.android.com/guide/developing/devices/emulator.html Emulator Limitations
In this release, the limitations of the emulator include:
- No support for placing or receiving actual phone calls. You can simulate phone calls (placed and received) through the emulator console, however.
- No support for USB connections
- No support for camera/video capture (input).
- No support for device-attached headphones
- No support for determining connected state
- No support for determining battery charge level and AC charging state
- No support for determining SD card insert/eject
- No support for Bluetooth
Q. Bluetooth doesn’t work on my device. How should I debug?
A. First step — read the logs ( adb logcat )! In particular look for ERROR or WARNING level messages regarding Bluetooth.
Andoird uses Bluez, which comes with some very useful debugging tools. Here are some examples, in the rough order I use to debug BT.
hciconfig -a # print BT chipset address and features. Useful to # check if you can communicate with your BT chipset. hcidump -XVt # print live HCI UART traffic. hcitool scan # scan for local devices. Useful to check if RX/TX works. l2ping ADDRESS # ping another BT device. Useful to check if RX/TX works. sdptool records ADDRESS # request the SDP records of another BT device.
E/BluetoothAdapter(883): связыватель Bluetooth имеет значение null
Откуда эта ошибка? У вас есть полный стек, показывающий линию? Вы прочитали полный javadoc для enable() ? (который очень полон некоторыми очень важными советами) — person Orabîg   schedule 23.01.2013
Я, может быть, слепой, но я не вижу сообщения об ошибке в стеке. Связь между этим стеком и вашей проблемой даже не ясна. — person Orabîg   schedule 23.01.2013
@Orabîg Иногда единственная ошибка в стеке — первая. Большую часть времени стек дает последние ошибки. Код правильный? — person John poer   schedule 23.01.2013
@Orabîg, если это возможно, могу ли я запустить ваш ADT? — person John poer   schedule 23.01.2013
Ответы (3)
Эмулятор не поддерживает Bluetooth, как указано в документации SDK. Вы должны проверить это на реальном устройстве. И вы получили сообщение об ошибке Bluetooth binder is null. это означает, что эмулятор не поддерживает Bluetooth.
Эмулятор Android не поддерживает Bluetooth. Вот почему вы получаете ошибку. Вы можете использовать смартфон, подключенный к компьютеру/ноутбуку, для тестирования приложения.
Из-за отсутствия информации в вашем сообщении я предполагаю, что ваш класс расширяет сервис из-за этой строки:
android.app.ServiceConnectionLeaked: Service
unbindService(whatever_your_service_object_are);
Если это ответ совершенно неправильный, опубликуйте еще немного кода с объявлением класса и так далее.
public class BluetoothAdmin extends Activity implements OnCheckedChangeListener . Если вам нужен конкретный код, я опубликую — person John poer; 23.01.2013
Пожалуйста, опубликуйте весь код, касающийся этой проблемы, это нам очень поможет. И, пожалуйста, не публикуйте половину LogCat. — person Tobias Moe Thorstensen; 23.01.2013
извините за моего идиота. Недавно я узнал, что эмулятор Android не поддерживает Bluetooth. Я добавил вверху вопроса. — person John poer; 23.01.2013