powered by Jive Software

Could not determine Smack version - on Unity/Android

Hello,

I’m developing an Unity application with Java/Andoid libraries. As server uses XMPP, I use smack to communicate with server. (Server is coded with prosody.im)

When I test codes without Unity, there is no problem. I can run application with smack via PC(win/java) or native Android app. But problem occurs when I run it with Unity.

I attached logcat below.

Do you have any idea? I googled this error but there were not many questions and no answers…

Thanks in advance

p.s. I’m developing without maven or gradle. just importing jars directly into java side project. (for management of Android plugin of Unity)

p.s.2. Error occurs at this line (Class#2.java:49)

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()

.setUsernameAndPassword(id, password).setServiceName(SERVICE_NAME).setHost(host).setResource(RESOURCE)

.build();

– Error Log –

08-30 17:36:23.904: E/SmackInitialization(23634): Could not determine Smack version

08-30 17:36:23.904: E/SmackInitialization(23634): java.lang.NullPointerException: lock == null

08-30 17:36:23.904: E/SmackInitialization(23634): at java.io.Reader.(Reader.java:64)

08-30 17:36:23.904: E/SmackInitialization(23634): at java.io.InputStreamReader.(InputStreamReader.java:122)

08-30 17:36:23.904: E/SmackInitialization(23634): at java.io.InputStreamReader.(InputStreamReader.java:57)

08-30 17:36:23.904: E/SmackInitialization(23634): at org.jivesoftware.smack.SmackInitialization.(SmackInitialization.java:61 )

08-30 17:36:23.904: E/SmackInitialization(23634): at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96 )

08-30 17:36:23.904: E/SmackInitialization(23634): at org.jivesoftware.smack.ConnectionConfiguration.(ConnectionConfiguration .java:38)

08-30 17:36:23.904: E/SmackInitialization(23634): at [remove package name for security issues].(Class#2.java:49)

08-30 17:36:23.904: E/SmackInitialization(23634): at remove package name for security issues

08-30 17:36:23.904: E/SmackInitialization(23634): at remove package name for security issues

08-30 17:36:23.904: E/SmackInitialization(23634): at [remove package name for security issues].MainActivity$3.run(MainActivity.java:70)

08-30 17:36:23.904: E/SmackInitialization(23634): at java.lang.Thread.run(Thread.java:818)

08-30 17:36:23.914: E/AndroidRuntime(23634): FATAL EXCEPTION: Thread-22292

08-30 17:36:23.914: E/AndroidRuntime(23634): Process: com.aibrain.giar.lite, PID: 23634

08-30 17:36:23.914: E/AndroidRuntime(23634): java.lang.Error: FATAL EXCEPTION [Thread-22292]

08-30 17:36:23.914: E/AndroidRuntime(23634): Unity version : 5.4.0f3

08-30 17:36:23.914: E/AndroidRuntime(23634): Device model : samsung SM-N920K

08-30 17:36:23.914: E/AndroidRuntime(23634): Device fingerprint: [remove for security]

08-30 17:36:23.914: E/AndroidRuntime(23634): Caused by: java.lang.ExceptionInInitializerError

08-30 17:36:23.914: E/AndroidRuntime(23634): at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96 )

08-30 17:36:23.914: E/AndroidRuntime(23634): at org.jivesoftware.smack.ConnectionConfiguration.(ConnectionConfiguration .java:38)

08-30 17:36:23.914: E/AndroidRuntime(23634): at [remove package name for security issues].(Class#2.java:49)

08-30 17:36:23.914: E/AndroidRuntime(23634): at remove package name for security issues

08-30 17:36:23.914: E/AndroidRuntime(23634): at remove package name for security issues

08-30 17:36:23.914: E/AndroidRuntime(23634): at [remove package name for security issues].MainActivity$3.run(MainActivity.java:70)

08-30 17:36:23.914: E/AndroidRuntime(23634): at java.lang.Thread.run(Thread.java:818)

08-30 17:36:23.914: E/AndroidRuntime(23634): Caused by: java.lang.IllegalStateException: java.lang.IllegalArgumentException: is == null

08-30 17:36:23.914: E/AndroidRuntime(23634): at org.jivesoftware.smack.SmackInitialization.(SmackInitialization.java:11 9)

08-30 17:36:23.914: E/AndroidRuntime(23634): … 7 more

08-30 17:36:23.914: E/AndroidRuntime(23634): Caused by: java.lang.IllegalArgumentException: is == null

08-30 17:36:23.914: E/AndroidRuntime(23634): at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1634)

08-30 17:36:23.914: E/AndroidRuntime(23634): at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitializatio n.java:155)

08-30 17:36:23.914: E/AndroidRuntime(23634): at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitializatio n.java:148)

08-30 17:36:23.914: E/AndroidRuntime(23634): at org.jivesoftware.smack.SmackInitialization.(SmackInitialization.java:11 6)

08-30 17:36:23.914: E/AndroidRuntime(23634): … 7 more

08-30 17:36:23.924: W/ActivityManager(3662): Force finishing activity com.aibrain.giar.lite/.MainActivity

EDIT:

I disassembled code where error occurs, and found that

XMPPTCPConnectionConfiguration.builder();

was where the bug occurs.

I’m using smack 4.1.8 and using these jars:

smack-android-4.1.8

smack-android-extensions-4.1.8

smack-core-4.1.8

smack-extensions-4.1.8

smack-im-4.1.8

smack-tcp-4.1.8

I disassembled code where error occurs, and found that
Why disassemble code of open source projects?

It appears the Smack resources are missing. Possible that Unity does not include them into the runtime environment for whatever reason.

Sorry, I misused ‘disassemble’ :-p

Anyway, you mean it is the problem of Unity, right?

Then, is there no way to skip version check?

It looks like Unity can not handle

“classpath:org.jivesoftware.smack/smack-config.xml”

or

“classpath:org.jivesoftware.smack/version”

Smack needs those files on initialization in order to be usable.

Thanks for your help

I think I need to find other libraries or other way

Hello Arin,

I am facing same issue, you got solution ?