IllegalStateException

0 votes
hi. I a developing an android two-player game. In method ondestroy I disconnect users. when I reload the app in emulator IllegalStateException happens and my code in ondestroy is not called and so when I see the lobby the previous user is shown to be online(because ondestroy wasn't called and as a result the user is considered online). how can I handle this so if any exception happens I can disconnect users? what is this IllegalStateException? here is the stacktrace:

03-13 04:18:36.491    7937-7937/my.second.attempt.BackGammon E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: my.second.attempt.BackGammon, PID: 7937
    java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for my.second.attempt.BackGammon; is package not installed?
            at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317)
            at android.app.ActivityThread.access$1500(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: Unable to get package info for my.second.attempt.BackGammon; is package not installed?
            at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:376)
            at android.app.LoadedApk.getClassLoader(LoadedApk.java:329)
            at android.app.LoadedApk.makeApplication(LoadedApk.java:508)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317)
            at android.app.ActivityThread.access$1500(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)

thanks.
asked Mar 13, 2015 in AppWarp by Arash Shahzamani (25 points)

1 Answer

0 votes
Hi,

Are you using threads? If so please use runOnUIThread method to handle threads.

You might be using Connection resiliency. When connection resiliency is used, server retains the user for recover allowance time if disconnect is not called. But server will remove it after recovery allowance time is over.

Thanks
answered Mar 13, 2015 by Suyash Mohan (900 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...