I build with Eclipse added asmack 4.0.4 and dnsjava2.0.1, compile success, but crash when running in android pad. The error is: java.lang.NoClassDefFoundError:org.jivesoftware.smack.SmackAndroid. If I replace with asmack0.8.10, it work well. Please give me some advise, thank you!
Try a clean build and ensure that SmackAndroid is within the classpath.
I have add into build path.
My code is:
public class MainActivity extends Activity {
private WaitingDialog mDlg = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SmackAndroid.init(this);
//PPConnection.DEBUG_ENABLED = true;
AccountManager accountManager;
final ConnectionConfiguration connectionConfig = new ConnectionConfiguration(
“192.168.1.120”, Integer.parseInt(“5222”), “localhost”);
…
When run to SmackAndroid.init(this); the app crash in android phone.
I can not understand why asmack0.8.10.jar can work well in my phone.
I copy the jar file to libs foder of Android project. If I replace 0.8.10 version, it can run well. Only 4.0.0-rc1 and later have problem. My code in Activity is just one line:
SmackAndroid.init(this);
The reason is the version of ADT. After updating latest version 23.0.2, asmack 4 work ok.