1
我想提出一個Android插件團結,我需要XMPP在統一集成,因此首先我想創建XMPP的連接併發送和接收消息。 它了Android做工精細,我能夠發送和接收消息但是,當我出口的.jar文件和統一使用,所以我得到了下面的錯誤,而我創建連接SmackInitialization:無法確定啪版本
SmackInitialization: Could not determine Smack version
java.lang.NullPointerException: lock == null
at java.io.Reader.<init>(Reader.java:64)
at java.io.InputStreamReader.<init>(InputStreamReader.java:122)
at java.io.InputStreamReader.<init>(InputStreamReader.java:57)
at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:61)
at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:38)
at com.arvaan.myplugins.ToastExample.connectXMPP(ToastExample.java:99)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.a(Unknown Source)
at com.unity3d.player.UnityPlayer$b$1.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:234)
at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
我不知道Smack有什麼問題,我是Unity新手,我知道如何在Unity中創建插件和調用方法,但不知道這裏有什麼問題。
請檢查代碼:
public class ToastExample extends UnityPlayerActivity implements ConnectionListener, ChatManagerListener, RosterListener, PingFailedListener, StanzaListener, MessageListener, ChatMessageListener {
private static final String TAG = ToastExample.class.getSimpleName();
private AbstractXMPPConnection mConnection = null;
private ChatManager chatManager;
private Chat chat;
private Context context;
private String userName = "";
private String passWord = "";
private String objectName = "";
private static ToastExample instance;
public ToastExample() {
this.instance = this;
}
public static ToastExample instance() {
if (instance == null) {
instance = new ToastExample();
}
return instance;
}
public void setContext(Context context) { // This is also working fine
Log.e(TAG, "setContext called");
this.context = context;
}
public void showMessage(String message) { // I can able to see toast
Toast.makeText(this.context, message, Toast.LENGTH_SHORT).show();
}
public void connectXMPP(String host, int port, String userName, String passWord) {
Log.e(TAG, "_connectXMPP called");
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder(); // Here i got error
configBuilder.setUsernameAndPassword(userName, passWord);
...............
...............
}
我使用低於我的插件.JAR文件和Unity
smack-core-4.1.4.jar
smack-extensions-4.1.4.jar
smack-im-4.1.4.jar
smack-android-4.1.4.jar
smack-android-extensions-4.1.4.jar
smack-tcp-4.1.4.jar
jxmpp-util-cache-0.4.2.jar
jxmpp-core-0.4.2.jar
jxmpp-jid-0.4.2.jar
jxmpp-stringprep-libidn-0.4.2.jar
minidns-core-0.2.0.jar**
有人也面臨這樣的問題,但沒有發現Check more
請幫我解決這個問題,謝謝提前。
您好,我想你的解決方案,但我不斷收到錯誤(與DNS解析器)。你可以請給我發電子郵件基地項目,你工作(只有聊天庫)?我真的很感激這一點。謝謝。 –
可以請你分享你的錯誤 –
https://gist.github.com/mmvlad/35f51f8c438651608350273437c1fc65 我加了咂嘴,旋轉變壓器minidns,minidns核到庫,但錯誤依然存在 –