Unable to understand why this error frequently comes on some android devices and app gets crash.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{.ChatMessageActivity}: java.lang.IllegalArgumentException: Must have a local (user) JID set. Either you didn't configure one or you where not connected at least once
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2493)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2555)
at android.app.ActivityThread.access$800(ActivityThread.java:176)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1437)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5576)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:956)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)
Caused by java.lang.IllegalArgumentException: Must have a local (user) JID set. Either you didn't configure one or you where not connected at least once
at org.jivesoftware.smack.filter.IQReplyFilter.<init>(IQReplyFilter.java:94)
at org.jivesoftware.smack.AbstractXMPPConnection.createPacketCollectorAndSend(AbstractXMPPConnection.java:690)
at org.jivesoftware.smackx.iqlast.LastActivityManager.getLastActivity(LastActivityManager.java:239)
at com.studyboard.utils.ChatUtil.getLastActivity(ChatUtil.java:674)
at com.studyboard.ChatMessageActivity.initChat(ChatMessageActivity.java:339)
at com.studyboard.ChatMessageActivity.onCreate(ChatMessageActivity.java:220)
at android.app.Activity.performCreate(Activity.java:6005)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2446)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2555)
at android.app.ActivityThread.access$800(ActivityThread.java:176)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1437)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5576)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:956)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)
Actual error occurs in below function which returns me last status of user for with I am chatting:-
public String getLastActivity(XMPPTCPConnection objXmpptcpConnection, String strUser) { try {
LastActivityManager objLastActivityManager = LastActivityManager.getInstanceFor(objXmpptcpConnection);
LastActivity objLastActivity = null;
objLastActivity = objLastActivityManager.getLastActivity(strUser + "@" + Constants.HOST);
System.out.println("MESSAGE:" + objLastActivity.getStatusMessage());
System.out.println("IDLE TIME::" + objLastActivity.getIdleTime()); return convertTime(objLastActivity.getIdleTime()); } catch (SmackException.NoResponseException e) {
e.printStackTrace();
return "Offline";
} catch (XMPPException.XMPPErrorException e) {
e.printStackTrace();
return "Offline";
} catch (SmackException.NotConnectedException e) {
e.printStackTrace();
return "Offline";
} }
I have get error on line number 6 in above function.
Please suggest solution.Thanks in advacne.