fewlaps / flone-android

🚁 A remote controller for drones with CleanFlight boards
http://flone.cc
55 stars 13 forks source link

Null pointer exception in connecting through bluetooth #45

Closed jeremyqi closed 6 years ago

jeremyqi commented 8 years ago

Hello,

I built a drone following the flone 3.0 instructable. When I try to connect with the drone, which has a bluetooth HC-05, with a Samsung S6, I always got an error: Unfortunately, Flone stops working.

So I did a little debugging. Here is the output when the error appears:

D/MULTIWII: BT connection established, data transfer link open. D/MULTIWII: setState() 2 -> 3 D/ccc: setState() Handle=null error state -> 3 D/MULTIWII: + getOutputStream getInputStream + D/Event: No subscribers registered for event class com.fewlaps.flone.data.bean.PhoneSensorsData D/Event: No subscribers registered for event class de.greenrobot.event.NoSubscriberEvent D/BluetoothSocket: getOutputStream(): myUserId = 0 D/RUNNABLE: sendRawDataRunnable.run() D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.fewlaps.flone, PID: 4435 java.lang.NullPointerException: Attempt to invoke virtual method 'void com.fewlaps.flone.io.communication.protocol.MultirotorData$ConnectedThread.write(byte[])' on a null object reference at com.fewlaps.flone.io.communication.protocol.MultirotorData.write(MultirotorData.java:270) at com.fewlaps.flone.io.communication.protocol.MultiWii230.sendRequestMSP(MultiWii230.java:107) at com.fewlaps.flone.io.communication.protocol.MultiWii230.sendRequestMSP_SET_RAW_RC(MultiWii230.java:668) at com.fewlaps.flone.service.DroneService$3.run(DroneService.java:202) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7237) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) D/BluetoothSocket: getInputStream(): myUserId = 0

Any idea?

Thanks! Jeremy

rocboronat commented 7 years ago

Woaw @jeremyqi , that's really strange. Have you tried with another phone?

You are using the same flight controller and Bluetooth module than me... so... quite strange :·/

EsteveAguilera commented 7 years ago

Hi @jeremyqi have you been able to connect the app with the HC-05 bluetooth module?

rocboronat commented 6 years ago

This issue is too old, and the author doesn't anwer :·(