我想创建一个使用Unity3D(单声道/ C#)的Jabber(Jabber.net)聊天客户端iOS和Android。我得到了在iOS中工作的客户端(在Unity模拟器中也能很好地运行)。但是,在Nexus 7或HTC Desire上运行时,它不起作用。它不会崩溃,但也不会连接。它只是产生以下错误:Jabber.net在Unity/Android错误(在/system/lib/libc.so中找不到JNI_OnLoad,跳过初始化)
D/dalvikvm(9368): No JNI_OnLoad found in /system/lib/libc.so 0x413b7270, skipping init
此错误是连接到我的Jabber.net客户端的连接方法:
jc = new JabberClient();
...
// Setting up the jabberclient and attaching eventhandlers
...
jc.Connect();
任何想法如何解决呢?
编辑:指导员研究JNI_OnLoad,我发现这样的描述:
"The VM calls JNI_OnLoad when the native library is loaded (for example, through System.loadLibrary). JNI_OnLoad must return the JNI version needed by the native library. In order to use any of the new JNI functions, a native library must export a JNI_OnLoad function that returns JNI_VERSION_1_2. If the native library does not export a JNI_OnLoad function, the VM assumes that the library only requires JNI version JNI_VERSION_1_1. If the VM does not recognize the version number returned by JNI_OnLoad, the native library cannot be loaded."
http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/invocation.html#wp9502从
莫非能够重建Jabber.net与JNI_OnLoad方法返回JNI_VERSION_1_2 ??
我的结论也是如此。改为使用ASmack,并为Android构建自定义版本,然后使用Unity方法在jar文件中调用Java代码。 – Sunkas