引起的:. lang。IllegalStateException:包没有安装?

时间:2022-03-27 17:41:30
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:

我的logcat中出现了这样的错误。虽然我有这个错误,我的项目运行良好。关于这个错误,我想澄清以下几点:

1.what causes this error?

2.what may happened if the error persist?

3.how to fix this error?

3 个解决方案

#1


13  

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重新运行应用程序之前卸载该应用程序,则不会发生这种情况。而且,这不会引起任何问题。

#2


0  

Try using older gradle dependencies version in you build.gradle file. It helped me.

尝试在您的构建中使用旧的等级依赖版本。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错误

#3


-1  

min sdk version and target sdk version should be same..

最小sdk版本和目标sdk版本应该是一样的。

#1


13  

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重新运行应用程序之前卸载该应用程序,则不会发生这种情况。而且,这不会引起任何问题。

#2


0  

Try using older gradle dependencies version in you build.gradle file. It helped me.

尝试在您的构建中使用旧的等级依赖版本。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错误

#3


-1  

min sdk version and target sdk version should be same..

最小sdk版本和目标sdk版本应该是一样的。