问题
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 jar
s in releases
directory.
Another alternative is to use already pre-built jar
s 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