How to implement XMPP chat in an android app?

心不动则不痛 提交于 2020-01-06 13:27:12

问题


I tried using the Smack library, but all i get is this:

05-07 04:28:43.299    2958-2958/g.d.allinonechat E/dalvikvm﹕ Could not find class 'javax.naming.directory.InitialDirContext', referenced from method org.jivesoftware.smack.util.dns.JavaxResolver.<clinit>

that with a search on Google i found out, Google doesn't let some JRE classes work on Android, so.. nothing to do here

tried aSmack, i'm using windows, tried compiling it on Linux Ubuntu, but it wouldn't compile

./build.bash line 142 /root/Desktop/asmack-master/version-tags/4.0.0-rc2-SNAPSHOT-2014-04-27.tag: No such file or directory

the file doesn't exist, but i tried downloading the zipped file twice, and it isn't there nor it is dynamically generated.

Is there any other library i could use to connect to my Openfire server?

Thank You.


回答1:


Regarding your own build of aSmack; I had exactly the same problem with the build script.

I discovered that directories releases and version-tags were missing. In your configuration I suggest to execute:

mkdir -p /root/Desktop/asmack-master/version-tags/
mkdir -p /root/Desktop/asmack-master/releases/
cd /root/Desktop/asmack-master/build.bash
./build.bash

Also do not forget to create local.properties file for ant in order to build final jar.

cp /root/Desktop/asmack-master/local.properties{.example,}

It is needed to set path to the Android-SDK in the local.properties. In my environment it looks like this:

sdk-location=${user.home}/android-sdk-linux/

Then you can find final jars in releases directory.

Another alternative is to use already pre-built jars of aSmack http://asmack.freakempire.de/ as aSmack GitHub page suggests.

Edit: Problem with non-existing directories has been just fixed in the aSmack project. Build script will create them in case they are missing.



来源:https://stackoverflow.com/questions/23507724/how-to-implement-xmpp-chat-in-an-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!