Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 服务发现失败[Ljava.lang.StackTraceeElement_Android_Eclipse_Bluetooth - Fatal编程技术网

Android 服务发现失败[Ljava.lang.StackTraceeElement

Android 服务发现失败[Ljava.lang.StackTraceeElement,android,eclipse,bluetooth,Android,Eclipse,Bluetooth,我刚刚用Android和bluetooth开发完我的应用程序。你可以发送消息共享文件,用bluetooth聊天。每次显示错误时,这是一个非常奇怪的应用程序,其他时候,它工作正常。下面是我的主要问题 E/BluetoothEventLoop.cpp(298):onCreateDeviceResult:D-Bus错误:org.bluez.error.AlreadyExists(已存在)` 第二个错误: 服务发现失败[Ljava.lang.StackTraceeElement 我的代码: pr

我刚刚用Android和bluetooth开发完我的应用程序。你可以发送消息共享文件,用bluetooth聊天。每次显示错误时,这是一个非常奇怪的应用程序,其他时候,它工作正常。下面是我的主要问题

E/BluetoothEventLoop.cpp(298):onCreateDeviceResult:D-Bus错误:org.bluez.error.AlreadyExists(已存在)`

第二个错误:

服务发现失败[Ljava.lang.StackTraceeElement

我的代码:

    private BluetoothSocket getLaSocketConnecte(BluetoothDevice myBtServer, UUID uuidToTry)           
    { 
      BluetoothSocket myBSock; 
      try 
      { 
        if (BtAdapter.isDiscovering()) 
        { 
          BtAdapter.cancelDiscovery(); 
        } 
        myBSock = myBtServer.createRfcommSocketToServiceRecord(uuidToTry);
        myBSock.connect(); 
        return myBSock; 
      } catch (Exception e) { 
        Log.i(TAG,"IOException . Msg d'erreur :" + e.getMessage()+ e.getStackTrace()); 
      } 
      return null; 
    }
下面是日志:

04-01 20:38:28.079: I/Connexion(9240): Msg d'erreur : Msg d erreur 

:Service discovery failed
04-01 20:38:28.079: I/Connexion(9240): java.io.IOException: Service discovery failed
04-01 20:38:28.079: I/Connexion(9240):  at android.bluetooth.BluetoothSocket$SdpHelper.doSdp(BluetoothSocket.java:403)
04-01 20:38:28.079: I/Connexion(9240):  at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:213)
            myBSock.connect();
04-01 20:38:28.079: I/Connexion(9240):  at com.Android.Bt.Connexion.getLaSocketConnecte(Connexion.java:190)
04-01 20:38:28.079: I/Connexion(9240):  at com.Android.Bt.Connexion.connecterA(Connexion.java:149)
            btSock = getLaSocketConnecte(btDevice, uuidList.get(i));
04-01 20:38:28.079: I/Connexion(9240):  at com.Android.Bt.Connexion.ConnecterTousLesAppreils(Connexion.java:293)
            connecterA(device.getKey());
04-01 20:38:28.079: I/Connexion(9240):  at com.Android.Bt.Connexion.EnvoyeBroadcastMsg(Connexion.java:428)
04-01 20:38:28.079: I/Connexion(9240):  at com.Android.Bt.Connexion.broadcastMessage(Connexion.java:205)
04-01 20:38:28.079: I/Connexion(9240):  at com.Android.Bt.BtPaquetReceiver.onReceive(BtPaquetReceiver.java:28)
你能帮我找出解决办法吗

谢谢:)



当时的问题与Bluetooth API有关!

请提供您的源代码和logcathi,Eclipse不要给我一行代码希望有问题没有人能在评论中阅读代码…将其添加到问题中!请将
Log.i(TAG,“IOException.Msg d'erreur:+e.getMessage()+e.getStackTrace());
更改为
Log.e(TAG,“IOException.Msg d'erreur:”+e.getMessage(),e);
并发布您获取的堆栈跟踪,因此我修复了这两个设备,然后问题出现了