eclipse-paho / paho.mqtt.android

MQTT Android
Other
2.94k stars 891 forks source link

Caused by: java.util.MissingResourceException: Can't find bundle for base name org.eclipse.paho.client.mqttv3.internal.nls.logcat, locale en_US #369

Open reytum opened 5 years ago

reytum commented 5 years ago

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

Android API Version Bug Seen on: 26

Android Version Bug Seen on: 8.1

Library used:

implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0'

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:

App crashes when calling MqttClient.connect Its happening in a ReactNative project.

Console Log output (if available):

Crash logs:

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:354)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.ExceptionInInitializerError
        at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:229)
        at com.applozic.mobicomkit.api.AlMqttClient.<init>(AlMqttClient.java:21)
        at com.applozic.mobicomkit.api.ApplozicMqttService.connect(ApplozicMqttService.java:72)
        at com.applozic.mobicomkit.api.ApplozicMqttService.connectPublish(ApplozicMqttService.java:107)
        at com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService.onHandleWork(ApplozicMqttIntentService.java:85)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:391)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:382)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.util.MissingResourceException: Can't find bundle for base name org.eclipse.paho.client.mqttv3.internal.nls.logcat, locale en_US
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1558)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1381)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:771)
        at org.eclipse.paho.client.mqttv3.logging.LoggerFactory.getLogger(LoggerFactory.java:72)
        at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<clinit>(MqttAsyncClient.java:103)
        at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:229)
        at com.applozic.mobicomkit.api.AlMqttClient.<init>(AlMqttClient.java:21)
        at com.applozic.mobicomkit.api.ApplozicMqttService.connect(ApplozicMqttService.java:72)
        at com.applozic.mobicomkit.api.ApplozicMqttService.connectPublish(ApplozicMqttService.java:107)
        at com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService.onHandleWork(ApplozicMqttIntentService.java:85)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:391)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:382)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
        at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:314)
        at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:268)
        at java.util.jar.JarVerifier.processEntry(JarVerifier.java:274)
        at java.util.jar.JarVerifier.update(JarVerifier.java:229)
        at java.util.jar.JarFile.initializeVerifier(JarFile.java:374)
        at java.util.jar.JarFile.getInputStream(JarFile.java:441)
        at libcore.io.ClassPathURLStreamHandler$ClassPathURLConnection.getInputStream(ClassPathURLStreamHandler.java:177)
        at java.net.URL.openStream(URL.java:1072)
        at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:989)
        at java.util.ResourceBundle$Control$1.run(ResourceBundle.java:2673)
        at java.util.ResourceBundle$Control$1.run(ResourceBundle.java:2658)
        at java.security.AccessController.doPrivileged(AccessController.java:69)
        at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2657)
        at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1495)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1459)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1413)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1413)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1355)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:771)
        at org.eclipse.paho.client.mqttv3.logging.LoggerFactory.getLogger(LoggerFactory.java:72)
        at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<clinit>(MqttAsyncClient.java:103)
        at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:229)
        at com.applozic.mobicomkit.api.AlMqttClient.<init>(AlMqttClient.java:21)
        at com.applozic.mobicomkit.api.ApplozicMqttService.connect(ApplozicMqttService.java:72)
        at com.applozic.mobicomkit.api.ApplozicMqttService.connectPublish(ApplozicMqttService.java:107)
        at com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService.onHandleWork(ApplozicMqttIntentService.java:85)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:391)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:382)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
reytum commented 5 years ago

@eclipsewebmaster Any update on this?

MP-ChengYanWei commented 5 years ago

@reytum Try modifying packagingOptions in the build. gradle file

Flying-Bullet commented 4 years ago

@godchengvip packagingOptions has any question?

WatchhWordd commented 4 years ago

@godchengvip packagingOptions has any question?

I hava a sample problem,because of we have been set packagingOptions as: packagingOptions { exclude 'META-INF/*' } this setting will to do filter logcat.propties file, you can delete it

youuupeng commented 3 years ago

@godchengvip I also got the same exception:

java.util.MissingResourceException: Can't find bundle for base name org.eclipse.paho.client.mqttv3.internal.nls.logcat, locale zh_CN

But it's in IMqttActionListener#onFailure(token: IMqttToken?, exception: Throwable) And i don't have the packagingOptions in my build. gradle file

elefnikolaidis commented 3 years ago

Solved this by adding -keep class org.eclipse.paho.client.mqttv3.logging.JSR47Logger { *; } in the proguard-rules.pro file!

Found here.

Killometer commented 3 years ago

try to change: [implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'] to: [implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.4']

change the mqttv3 version to 1.2.4

The update history about Eclipse Paho Client Mqttv3

sermoz commented 1 year ago

@elefnikolaidis I'm not using Proguard at all and still having this issue. May be you get any ideas of how to fix it? I checked the resulting classes.dex file with the dexdump tool, and this JSR47Logger class is in there.

youuupeng commented 1 year ago

已收到,谢谢。我会尽快查收的。

grabismartsolutions commented 1 year ago

@elefnikolaidis I'm not using Proguard at all and still having this issue. May be you get any ideas of how to fix it? I checked the resulting classes.dex file with the dexdump tool, and this JSR47Logger class is in there.

@egnartsms Maybe adding Proguard will help you solve the issue? It's been ages I fixed this. I would suggest trying different versions of the library. (btw, I'm elefnikolaidis, just with a different account xD)

sermoz commented 1 year ago

@grabismartsolutions I managed to solve this issue. The thing is that all internal/nls/* .properties files should be included in the resulting .jar. These files are being accessed at runtime. I did this by calling aapt add <my.apk> <all_files> from command line (in a script). It was crazy.

youuupeng commented 1 year ago

已收到,谢谢。我会尽快查收的。