paho.mqtt.android icon indicating copy to clipboard operation
paho.mqtt.android copied to clipboard

java.lang.NullPointerException Attempt to invoke virtual method 'void org.eclipse.paho.android.service.MqttService.traceError(java.lang.String, java.lang.String)' on a null object reference

Open jianglijs opened this issue 6 years ago • 8 comments

org.eclipse.paho.android.service.MqttAndroidClient.void simpleAction(org.eclipse.paho.client.mqttv3.IMqttToken,android.os.Bundle)(MqttAndroidClient.java:1504) org.eclipse.paho.android.service.MqttAndroidClient.void sendAction(android.os.Bundle)(MqttAndroidClient.java:1516) org.eclipse.paho.android.service.MqttAndroidClient.void onReceive(android.content.Context,android.content.Intent)(MqttAndroidClient.java:1383) android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297) android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46) android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116) android.os.Handler.dispatchMessage(Handler.java:110) android.os.Looper.loop(Looper.java:203) android.app.ActivityThread.main(ActivityThread.java:6434) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:974)

jianglijs avatar Oct 10 '17 09:10 jianglijs

Hi,

Just pasting a stack trace into a bug isn't particularly helpful, please could you provide the information requested in the template you deleted:

  • The Version of the Library you are using,
  • The action that caused this stack trace to be thrown.

jpwsutton avatar Oct 11 '17 08:10 jpwsutton

library version:

  • org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.1
  • 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'

I don't how it occured.Because all action is async,i think you just need to add null judgment before calling the methods of mqttService.

thanks.

jianglijs avatar Oct 11 '17 09:10 jianglijs

me ,too.

ltigers avatar Oct 26 '17 04:10 ltigers

me to, how to solve it

JonaNorman avatar Jan 03 '19 03:01 JonaNorman

I am also getting this how to fix?

anoop4real avatar Feb 08 '19 15:02 anoop4real

Found the problem for me, the format of host should be

"tcp://" + hostname+ ":" + port .. I missed tcp.

anoop4real avatar Feb 09 '19 22:02 anoop4real

me ,too.

elinkthings avatar Jan 25 '21 07:01 elinkthings

I'm brazilian. So any mistakes forgive me. In your error message you mentioned BroadcastManager so try to put implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' in the build.gradle of app and if it persists put android.enableJetifier=true in the gradle.properties. I hope it solves it.

henriquerochamattos avatar Apr 30 '22 00:04 henriquerochamattos