eclipse / paho.mqtt.android

MQTT Android
Other
2.92k stars 883 forks source link

MQTT connection problem in android (Paho) #374

Closed karthikcse closed 3 years ago

karthikcse commented 5 years ago

Description of Bug:

app crash when ever the MQTT Brocker termination occur

Console Log output (if available):

E/AndroidRuntime: FATAL EXCEPTION: MQTT Con: paho1056446537855693 Process: com.mobitech.mconproject, PID: 16966 java.lang.NullPointerException: cancel() called with a null PendingIntent at android.app.AlarmManager.cancel(AlarmManager.java:945) at org.eclipse.paho.android.service.AlarmPingSender.stop(AlarmPingSender.java:86) at org.eclipse.paho.client.mqttv3.internal.ClientComms.shutdownConnection(ClientComms.java:327) at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:608) at java.lang.Thread.run(Thread.java:760)

akteruzzaman816 commented 4 years ago

Same problem I faced now. Does anyone have any solution??

Joesta commented 4 years ago

No solution as of yet. I am also experiencing the same problem. FATAL EXCEPTION: MQTT Con: paho260179451002981

A451323699 commented 4 years ago

I've also met it. How to solve this problem?

Joesta commented 4 years ago

Let me see the paho library you are using

A451323699 commented 4 years ago

Let me see the paho library you are using

implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0' implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1' The two above

Joesta commented 4 years ago

Alright. I am using the same libraries as yours. My problem with this exception was forgetting to close mqtt connection when not needed. Please verify your connection using MQTT client Application.

arindamhit commented 3 years ago

Anyone find the solution?

karthikcse commented 3 years ago

The issue has been solved by increasing the MQTT connection limit on the server-side.

TheMrPhantom commented 2 years ago

Using paho android service version org.eclipse.paho:org.eclipse.paho.android.service:1.1.1 fixed it for me

hunterkage commented 1 year ago

I confirm what @TheMrPhantom said, by upgrading the library, there is no crash and they are handling if a resource failed to call close as @Joesta said 👍