Android 手机无法进入系统解决方案

极力推荐文章:欢迎收藏
Android 干货分享

阅读五分钟,每日十点,和您一起终身学习,这里是程序员Android

1.手机卡在开机动画界面,无法正常进入系统解决方案

卡死在开机动画界面的原因是由RuntimeException: There must be exactly one installer导致的,部分 adb log 如下:

6 W system_server: Long monitor contention with owner main (1107) at void com.android.server.pm.PackageManagerService.<init>(android.content.Context, com.android.server.pm.Installer, boolean, boolean)(PackageManagerService.java:2543) waiters=0 in void com.android.server.pm.PackageManagerService.lambda$new$0(com.android.server.pm.PackageManagerService, java.util.List, int) for 1.091s
01-01 00:00:43.258  1107  1107 E System  : ******************************************
01-01 00:00:43.258   742   792 D AAL     : 01-01 12:00:43.084 BL= 358,ESS= 256, 01-01 12:00:43.119 BL= 359,ESS= 256, 01-01 12:00:43.171 BL= 360,ESS= 256, 01-01 12:00:43.206 BL= 361,ESS= 256, 01-01 12:00:43.258 BL= 362,ESS= 256, 
01-01 00:00:43.258  1107  1107 E System  : ************ Failure starting system services
01-01 00:00:43.258  1107  1107 E System  : java.lang.RuntimeException: There must be exactly one installer; found [ResolveInfo{65cb129 com.android.packageinstaller/.InstallStart m=0x608000}, ResolveInfo{2281cae com.google.android.packageinstaller/com.android.packageinstaller.InstallStart m=0x608000}]
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.server.pm.PackageManagerService.getRequiredInstallerLPr(PackageManagerService.java:3612)
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:3260)
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:2355)
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:648)
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.server.SystemServer.run(SystemServer.java:443)
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.server.SystemServer.main(SystemServer.java:304)
01-01 00:00:43.258  1107  1107 E System  : 	at java.lang.reflect.Method.invoke(Native Method)
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
01-01 00:00:43.258  1107  1107 E System  : 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:891)
01-01 00:00:43.258  1107  1107 D SystemServerTiming: StartPackageManagerService took to complete: 8749ms
01-01 00:00:43.259  1107  1107 E Zygote  : System zygote died with exception
01-01 00:00:43.259  1107  1107 E Zygote  : java.lang.RuntimeException: There must be exactly one installer; found [ResolveInfo{65cb129 com.android.packageinstaller/.InstallStart m=0x608000}, ResolveInfo{2281cae com.google.android.packageinstaller/com.android.packageinstaller.InstallStart m=0x608000}]
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.server.pm.PackageManagerService.getRequiredInstallerLPr(PackageManagerService.java:3612)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:3260)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:2355)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:648)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.server.SystemServer.run(SystemServer.java:443)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.server.SystemServer.main(SystemServer.java:304)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at java.lang.reflect.Method.invoke(Native Method)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
01-01 00:00:43.259  1107  1107 E Zygote  : 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:891)
01-01 00:00:43.259  1107  1107 D AndroidRuntime: Shutting down VM

查看bootprof(adb pull /proc/bootprof .) 界面,确实卡死在PackageManagerService 中,再次查看out下发现GooglePackageInstallerMtkPackageInstaller 都会在priv-app目录下生成。

bootprof

解决方案

去掉一个不用的PackageInstall app即可.
例如:
GMS 包里面的  gms\apps\GooglePackageInstaller\Android.mk 

把多的PackageInstall 添加到 LOCAL_OVERRIDES_PACKAGES := PackageInstaller MtkPackageInstaller

Android.mk文件如下:

###############################################################################
# GooglePackageInstaller
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := GooglePackageInstaller
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_PRIVILEGED_MODULE := true
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_OVERRIDES_PACKAGES := PackageInstaller MtkPackageInstaller
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
#LOCAL_REQUIRED_MODULES :=
#LOCAL_PREBUILT_JNI_LIBS :=
include $(BUILD_PREBUILT)

至此,本篇已结束,如有不对的地方,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!

微信关注公众号:  程序员Android,领福利

posted @ 2019-08-09 14:29  程序员Android  阅读(2315)  评论(0编辑  收藏  举报