XMPP Smack on Android

Smack 預設是給 java SE 的 http://www.igniterealtime.org/projects/smack/index.jsp

要 build Android 版本的話可以用 asmack https://github.com/Flowdalic/asmack

  1. git clone https://github.com/Flowdalic/asmack.git
  2. cd asmack
  3. vim README.asmack, ream the README
  4. copy local.properties.example to local.properties and set the Android SDK path, ex: sdk-location=${user.home}/android-sdk-linux

 

if you encounter below error


 

Symptom: javac: invalid source release: 7

Description: ant look for javac version 1.7 by default

Solution: echo “export JAVA_HOME=’/usr/lib/jvm/java-7-oracle/'" >> ~/.bashrc; source ~/.bashrc


Symptom: No SDKs of a suitable minimal API (8) version found

Description: default using API 8

Solution: ./build.bash -a 17, or other API version you have


Symptom: error: package org.junit does not exist

Description: can not find junit lib

Solution: download junit.jar from https://github.com/junit-team/junit/wiki/Download-and-Install. and add lib/junit-4.11.jar to classpath


Symptom: error: package gnu.inet.encoding does not exist

Description: can not find gnu.inet.encoding lib

Solution: google “gnu.inet.encoding download" and I download the lib from http://www.java2s.com/Code/Jar/l/Downloadlibidn19jar.htm