06-26 05:07:17.890: E/AndroidRuntime(3231): FATAL EXCEPTION: main
06-26 05:07:17.890: E/AndroidRuntime(3231): Process: com.sample.calendar, PID: 3231
06-26 05:07:17.890: E/AndroidRuntime(3231): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for com.sample.calendar; is package not installed?
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.os.Handler.dispatchMessage(Handler.java:102)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.os.Looper.loop(Looper.java:136)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.ActivityThread.main(ActivityThread.java:5017)
06-26 05:07:17.890: E/AndroidRuntime(3231): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 05:07:17.890: E/AndroidRuntime(3231): at java.lang.reflect.Method.invoke(Method.java:515)
06-26 05:07:17.890: E/AndroidRuntime(3231): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-26 05:07:17.890: E/AndroidRuntime(3231): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-26 05:07:17.890: E/AndroidRuntime(3231): at dalvik.system.NativeStart.main(Native Method)
06-26 05:07:17.890: E/AndroidRuntime(3231): Caused by: java.lang.IllegalStateException: Unable to get package info for com.sample.calendar; is package not installed?
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:376)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.LoadedApk.getClassLoader(LoadedApk.java:329)
06-26 05:07:17.890: E/AndroidRuntime(3231): at android.app.LoadedApk.makeApplication(LoadedApk.java:508)
06-26 05:07:17.890: E/AndroidRuntime(3231): ... 11 more
I'm getting this kind of error in my logcat. Although I'm getting this error my project runs ok.So i just want to clarify these things regarding this error:
1.what causes this error?
2.what may happened if the error persist?
3.how to fix this error?
What Causes IllegalStateException. The IllegalStateException is thrown when the Java environment or application is not in an appropriate state for the requested operation. This can occur when dealing with threads or the Collections framework of the java.
In order to avoid java. lang. IllegalStateException in Java main Thread we must ensure that any method in our code cannot be called at an illegal or an inappropriate time. In the above example if we call start() method only once on thread t then we will not get any java.
Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.
I think this happens when you run the app from eclipse while you already have the previous version installed ? This won't happen if you uninstall the app before running it again from eclipse. Also, this won't cause any problems.
Try using older gradle dependencies version in you build.gradle
file. It helped me.
Use:
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
Don't use:
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
I find solution here - Android Studio FloatingActionButton error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With