引起:java.lang.IllegalStateException:未安装包?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24426635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Caused by: java.lang.IllegalStateException: package not installed?
提问by Giant
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.access00(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:
我的 logcat 出现这种错误。虽然我收到此错误,但我的项目运行正常。所以我只想澄清有关此错误的这些事情:
1.what causes this error?
2.what may happened if the error persist?
3.how to fix this error?
采纳答案by Shivam Verma
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.
我认为当您已经安装了以前的版本时从 eclipse 运行应用程序时会发生这种情况吗?如果您在从 Eclipse 再次运行应用程序之前卸载该应用程序,则不会发生这种情况。此外,这不会造成任何问题。
回答by Mikhail
Try using older gradle dependencies version in you build.gradle
file. It helped me.
尝试在您的build.gradle
文件中使用较旧的 gradle 依赖项版本。它帮助了我。
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
我在这里找到解决方案 - Android Studio FloatingActionButton 错误