AnsweredAssumed Answered

Could not determine Smack version - on Unity/Android

Question asked by Arin on Aug 30, 2016
Latest reply on Jan 27, 2017 by mahesh

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.<init>(Reader.java:64)

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

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

08-30 17:36:23.904: E/SmackInitialization(23634): at org.jivesoftware.smack.SmackInitialization.<clinit>(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.<clinit>(ConnectionConfiguration .java:38)

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

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

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

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.<clinit>(ConnectionConfiguration .java:38)

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

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

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

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.<clinit>(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.<clinit>(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:

 

1.

 

I disassembled code where error occurs, and found that

 

XMPPTCPConnectionConfiguration.builder();

 

was where the bug occurs.

 

 

2.

 

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

Outcomes