Compiling aSmack

For a recent mobile project we used XMPP. It worked really well and I’m keen to use it again. But, in the process I learnt quite a lot about it. To start with, getting a working Android client was… interesting.

Android is a fascinating and interesting development environment. It may say Java on the tin, but it ain’t Java inside. And due to this, the otherwise great XMPP library Smack doesn’t work on Android. Instead you have to use the aSmack library. Which is actually a collection of patches and a build script. Compiled output is not to be found on the Internet. Additionally, the build script doesn’t work on Mac OS X. I built it on an Ubuntu Vagrant box. Here’s how.

Install Vagrant and VirtualBox.

 1 mkdir asmack && cd asmack
 2 vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
 3 vagrant init lucid32
 4 vagrant ssh
 5 sudo apt-get update
 6 sudo apt-get install git-core openjdk-6-jdk curl vim subversion ant advancecomp
 7 curl -O http://dl.google.com/android/android-sdk_r21.1-linux.tgz
 8 tar -xzvf android-sdk_r21.1-linux.tgz
 9 cd android-sdk-linux/
10 tools/android update sdk --no-ui
11 cd ..
12 git clone https://github.com/Flowdalic/asmack.git
13 cd asmack/
14 echo "sdk-location=/home/vagrant/android-sdk-linux" > local.properties
15 Edit build.xml. Remove the check-android-exists dependency from the compile-android target.
16 ./build.bash
17 cp build/asmack-android-17.jar /vagrant
18 exit

And you will now have asmack-android-17.jar sitting in your current directory.

http://overwatering.org/blog/2013/05/compiling-asmack/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值