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

java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets

Open VinPin opened this issue 3 years ago • 2 comments

Please fill out the form below before submitting, thank you!

  • [ ] Bug exists Release Version 1.1.1 (Java Repository Master Branch)
  • [ ] Bug exists in Snapshot Version 1.1.2-SNAPSHOT (Android Service Repository Master Branch)
  • [ ] Bug is just in the Sample Application.

__Android API Version Bug Seen on: 17

__Android Version Bug Seen on: 4.2

Please also check that if you have found the bug in the Release version (1.1.1) that you check that it also exists in the Snapshot (1.1.2-SNAPSHOT) before raising a bug.

Description of Bug:

The problem occurred in Android version 4.2 (API 17). Once the connection crashes, how can I solve it?

Console Log output (if available):

E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets at org.eclipse.paho.client.mqttv3.internal.wire.MqttWireMessage.(MqttWireMessage.java:52) at org.eclipse.paho.client.mqttv3.internal.ClientState.(ClientState.java:164) at org.eclipse.paho.client.mqttv3.internal.ClientComms.(ClientComms.java:110) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:594) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:438) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:322) at org.eclipse.paho.android.service.MqttConnection.connect(MqttConnection.java:289) at org.eclipse.paho.android.service.MqttService.connect(MqttService.java:329) at org.eclipse.paho.android.service.MqttAndroidClient.doConnect(MqttAndroidClient.java:467) at org.eclipse.paho.android.service.MqttAndroidClient.access$200(MqttAndroidClient.java:76) at org.eclipse.paho.android.service.MqttAndroidClient$MyServiceConnection.onServiceConnected(MqttAndroidClient.java:115) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1131) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1148) at android.os.Handler.handleCallback(Handler.java:800) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5392) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(Native Method)

VinPin avatar May 20 '21 09:05 VinPin

The problem has been solved. Because the StandardCharsets class is missing, we added it. Create a new package directory and copy the StandardCharsets class, and then run the verification successfully.

VinPin avatar May 21 '21 01:05 VinPin

Does it happen with https://github.com/hannesa2/paho.mqtt.android too ?

hannesa2 avatar Sep 12 '21 05:09 hannesa2