这是我第一次使用Android / Java.我正在尝试运行此基本代码,但不断出现以下错误:
“找不到方法引用的类’org.jivesoftware.smack.ConnectionConfiguration’”
>我的代码:
<code>package message.pack;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import android.app.Activity;
import android.os.Bundle;
public class ThesimpleigniteandroidActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public static void main(String[] args) {
ConnectionConfiguration conf = new ConnectionConfiguration("jabber.com",5222);
XMPPConnection connection = new XMPPConnection(conf);
try {
connection.connect();
connection.login("myusername", "mypassword");
} catch (XMPPException e) {
e.printStackTrace();
} finally {
connection.disconnect();
}
}
}
</code>
我正在使用此页面上的smack.jar:
http://vidorsolutions.blogspot.com/2011/01/writing-xmppjabber-chat-application-for.html?m=1
谁能告诉我我在做什么错?
解决方法:
这类似于围绕android项目中的外部jar的许多相关问题(尤其是使用新的sdk工具).解决方案是为您在项目中创建一个名为libs的文件夹,然后将jars复制到该文件夹??中.
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!