Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets in Android API < 19 #306

Closed
cokeperez opened this issue Sep 1, 2022 · 3 comments
Assignees

Comments

@cokeperez
Copy link

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
@rajeev-kommunicate
Copy link
Contributor

@cokeperez Thanks for letting us know this. We'll fix it in the next release.

@github-actions
Copy link

github-actions bot commented Oct 6, 2022

A friendly reminder that this issue had no activity for 30 days.

@amntoppo
Copy link
Contributor

amntoppo commented Nov 9, 2022

This has been resolved in #320
It will be available in the next release, scheduled on 25th November.

@amntoppo amntoppo closed this as completed Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants