我们仅在一种设备类型上使用我们的应用程序,我们经常会在其上遇到此错误。
PackageManager的唯一实例是BootupReceiver:
public class RestartHelper extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent) {
Logger.getInstance().Log("Restart received");
Intent i = context.getPackageManager().getLaunchIntentForPackage( context.getPackageName() );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(i);
}
}
例外:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.MainActivity}: java.lang.RuntimeException: Package manager has died
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
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:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Package manager has died
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:239)
at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:301)
at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:281)
at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:152)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:60)
at com.cotris.roosapp.StandardActivity.onCreate(StandardActivity.java:49)
at com.cotris.roosapp.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
... 11 more
Caused by: android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at android.content.pm.IPackageManager$Stub$Proxy.getActivityInfo(IPackageManager.java:1791)
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:234)
... 20 more
此错误与硬件/系统有关吗?
答案 0 :(得分:1)
android.os.DeadObjectException意味着你链接到不再存在的东西。
我案例的解决方案是一个与硬件相关的问题,它在设备的后台创建了所有类型的系统进程崩溃。
答案 1 :(得分:0)
显然还有另一个PackageManger调用,但不仅仅是在RestartHelper.java中:
at com.cotris.roosapp.StandardActivity.onCreate(StandardActivity.java:49)
你需要检查一下代码细节。