eclipse / paho.mqtt.android

MQTT Android
Other
2.88k stars 862 forks source link

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

Open VinPin opened 3 years ago

VinPin commented 3 years ago

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

__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 commented 3 years ago

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.

hannesa2 commented 2 years ago

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