hivemq-mqtt-client icon indicating copy to clipboard operation
hivemq-mqtt-client copied to clipboard

Infinite messages loop on Android release builds

Open symphonybiz opened this issue 1 year ago • 2 comments

Expected behavior

MQTT works normally on release builds by following the android guide: https://hivemq.github.io/hivemq-mqtt-client/docs/installation/android/

Actual behavior

On debug builds the client works fine, but on release builds we noticed the same MQTT message keeps being "received" forever in an infinite loop. This is seems to be happening because of proguard obfuscation.

Solution

We managed to fix this by adding an additional line to proguard:

-keep class com.hivemq.client.mqtt.mqtt5.message.Mqtt5Message { *; }

symphonybiz avatar Jul 22 '22 07:07 symphonybiz

The exception that gets thrown in this scenario is:

com.hivemq.client.mqtt.exceptions.ConnectionClosedException: java.lang.AbstractMethodError: abstract method "com.hivemq.client.mqtt.mqtt5.message.Mqtt5MessageType com.hivemq.client.internal.mqtt.message.MqttMessageWithUserProperties$WithReason$WithCode$WithId.getType()"

More specifically, it's not about debug vs release builds but rather about building with proguard vs without.

npace avatar Jul 22 '22 07:07 npace

I think I'm facing a similar issue, because on production build around 2-3 gb of data seems to be used per day. I'm using mqtt3 instead of mqtt5 though. How do I check if I'm receiving messages in a loop in production builds? Logs don't work.

Devenom1 avatar Sep 26 '22 14:09 Devenom1