eclipse / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.12k stars 884 forks source link

Paho Client as Android Libary #837

Open kavidriod opened 3 years ago

kavidriod commented 3 years ago

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

I'm currently exploring on paho client in my sample Android Application. Instead of using jar file I'm trying to use Source code of org.eclipse.paho.client.mqttv3 and org.eclipse.paho.android.service as Android Library. I'm able to successfully add source code of both jar files. But when I try to connect my app to mosquitto broker I'm getting this Exception.

Caused by: java.util.MissingResourceException: Can't find bundle for base name paho.mqtt.pahoclient.internal.nls.logcat, locale en_US

Error Screenshot is added here.

queryTogithub

Anyone faced these issue?

sp193 commented 3 years ago

Are you adding only the source code to your project? What about the resources? What's stopping you from just adding Paho as a dependency?

Minhtuyen28 commented 3 years ago

how to fix?

staneychan commented 3 years ago

@kavidriod I had solve this problem. 1.in the library build.gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) }

2.copy "org.eclipse.paho.client.mqttv3-1.2.5.jar" to the libs directory of the Library. remark : Copy the org.eclipse.paho.client.mqttv3-x.x.x.jar version you have.

3.The most important step: 3-1 ) Create the java resource folder on your Library Module : New > Folder > Java Resources Folder You will find a "resources" folder in "src/main" 3-2 ) Download the paho.mqtt.java source. Copy FOLDER : META-INF and org FILE : bundle.properties from "paho.mqtt.java-master\paho.mqtt.java-master\org.eclipse.paho.client.mqttv3\src\main\resources" to "src/main/resources"

4.Build your aar file and get it in build/outputs

manondidi commented 3 years ago

+1

kzqsky commented 2 years ago

+1

kzqsky commented 2 years ago

+1