Question

My android app keeps crashing before restarting again automatically. When it crashes (after I press Run) the log cat is,

02-17 13:26:59.550: E/AndroidRuntime(1072): FATAL EXCEPTION: main
02-17 13:26:59.550: E/AndroidRuntime(1072): java.lang.RuntimeException: Unable to         instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for com.example.con4; is package not installed?
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.LoadedApk.makeApplication(LoadedApk.java:509)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4417)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.ActivityThread.access$1300(ActivityThread.java:141)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.os.Looper.loop(Looper.java:137)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.ActivityThread.main(ActivityThread.java:5103)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at java.lang.reflect.Method.invokeNative(Native Method)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at java.lang.reflect.Method.invoke(Method.java:525)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at dalvik.system.NativeStart.main(Native Method)
02-17 13:26:59.550: E/AndroidRuntime(1072): Caused by: java.lang.IllegalStateException: Unable to get package info for com.example.con4; is package not installed?
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:369)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.LoadedApk.getClassLoader(LoadedApk.java:322)
02-17 13:26:59.550: E/AndroidRuntime(1072):     at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
02-17 13:26:59.550: E/AndroidRuntime(1072):     ... 11 more

It takes about 5 seconds before it comes back.

I have tried to research bits of the logcat but have many mixed results.

Is there any tips to make it work without crashing on runtime.

Was it helpful?

Solution

The problem was, I was performing all the main functionality on the main GUI thread.

I did multi-threading, now it works.

Also one of the reasons it crashed on the AVD was the memory on it was small, before multi-threading, on an actual device it had no issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top