Last week i got my Android phone and finally started coding for a mobile phone (which really is a great experience and lot’s of fun).
During my daylight work i’m using xmpp in different projects and tools and so i would really like to use it on the Android phone also. In the java world there is a really neat library called smack from ignite realtime which makes using xmpp a piece of cake and so i asked myself if it would also run on android?
Yes it does…BUT…you need a patched version that i found on the net…
In Eclipse it seems to be easy to link a external library to a android project but in Netbeans i was not so intuitively as i thought…
You need three little steps to include a external library like smack and here they are:
Create a local folder named „lib“ in your Android project folder like this:
Now copy the patched smack.jar file into this folder.
Add the jar file to your libraries in netbeans like this:
At last you have to edit the build.xml file of your android project and add the link to the /lib folder where you copied the library file.
Add the following to the end of your build.xml file:
<!– Add path to external libs to buildpath –>
<property name=„external.libs.dir“ value=“/PATH_TO_YOUR_PROJECT/lib„ />
<fileset dir=„/PATH_TO_YOUR_PROJECT/lib“ />
Now you should be able to use the external library in the same way as you know it from your normal desktop machine.
Be aware that the patched smack.jar does not contain the complete functionality of the desktop version…
You might also take a look at a project called asmack which you could find here…