java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets in Android API < 19
cokeperez opened this issue · 3 comments
We have been a long time with an old version of your library. Now, we have upgraded to the latest version and the library crashes on all the devices we have with API 16, 17 and 18. We have also tested your test app and it crashes as well.
The problem is in the org.eclipse.paho.client.mqttv3
library version. Version 1.2.1 and higher do not seem to support API < 19, because they use StandarCharsets and StandarCharsets was added in API 19.
For now we have fixed it by forcing the library version in our build.gradle
, while we hope you can release a new version with the problem fixed.
implementation('org.eclipse.paho:org.eclipse.paho.client.mqttv3') { version { strictly '1.2.0' } }
Stacktrace
2022-09-01 13:44:41.062 1993-2336/xxx.xxxxx.xxxxxx E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.ExceptionInInitializerError
at org.eclipse.paho.client.mqttv3.internal.ClientState.<init>(ClientState.java:162)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.<init>(ClientComms.java:108)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:470)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:320)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:315)
at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:227)
at com.applozic.mobicomkit.api.AlMqttClient.<init>(AlMqttClient.java:21)
at com.applozic.mobicomkit.api.ApplozicMqttService.connect(ApplozicMqttService.java:94)
at com.applozic.mobicomkit.api.ApplozicMqttService.connectPublish(ApplozicMqttService.java:126)
at com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService.onHandleWork(ApplozicMqttIntentService.java:104)
at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:396)
at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:387)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets
@cokeperez Thanks for letting us know this. We'll fix it in the next release.
A friendly reminder that this issue had no activity for 30 days.