2024年最全Google APK Crash 解决方案(2),温故而知新

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

12-31 21:01:26.711 3776 3776 E AndroidRuntime: FATAL EXCEPTION: main 12-31 21:01:26.711 3776 3776 E AndroidRuntime: Process: com.google.android.gms.ui, PID: 3776 12-31 21:01:26.711 3776 3776 E AndroidRuntime: android.view.WindowManager B a d T o k e n E x c e p t i o n : U n a b l e t o a d d w i n d o w − − t o k e n a n d r o i d . o s . B i n d e r P r o x y @ f 176911 i s n o t v a l i d ; i s y o u r a c t i v i t y r u n n i n g ? 12 − 3121 : 01 : 26.71137763776 E A n d r o i d R u n t i m e : a t a n d r o i d . v i e w . V i e w R o o t I m p l . s e t V i e w ( V i e w R o o t I m p l . j a v a : 567 ) 12 − 3121 : 01 : 26.71137763776 E A n d r o i d R u n t i m e : a t a n d r o i d . v i e w . W i n d o w M a n a g e r G l o b a l . a d d V i e w ( W i n d o w M a n a g e r G l o b a l . j a v a : 310 ) 12 − 3121 : 01 : 26.71137763776 E A n d r o i d R u n t i m e : a t a n d r o i d . v i e w . W i n d o w M a n a g e r I m p l . a d d V i e w ( W i n d o w M a n a g e r I m p l . j a v a : 85 ) 12 − 3121 : 01 : 26.71137763776 E A n d r o i d R u n t i m e : a t a n d r o i d . a p p . D i a l o g . s h o w ( D i a l o g . j a v a : 319 ) 12 − 3121 : 01 : 26.71137763776 E A n d r o i d R u n t i m e : a t c o m . g o o g l e . a n d r o i d . l o c a t i o n . n e t w o r k . C o n f i r m A l e r t C h i m e r a A c t i v i t y . a ( : c o m . g o o g l e . a n d r o i d . g m s : 164 ) 12 − 3121 : 01 : 26.71137763776 E A n d r o i d R u n t i m e : a t r z o . o n S e r v i c e C o n n e c t e d ( : c o m . g o o g l e . a n d r o i d . g m s : 71 ) 12 − 3121 : 01 : 26.71137763776 E A n d r o i d R u n t i m e : a t a n d r o i d . a p p . L o a d e d A p k BadTokenException: Unable to add window -- token android.os.BinderProxy@f176911 is not valid; is your activity running? 12-31 21:01:26.711 3776 3776 E AndroidRuntime: at android.view.ViewRootImpl.setView(ViewRootImpl.java:567) 12-31 21:01:26.711 3776 3776 E AndroidRuntime: at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:310) 12-31 21:01:26.711 3776 3776 E AndroidRuntime: at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85) 12-31 21:01:26.711 3776 3776 E AndroidRuntime: at android.app.Dialog.show(Dialog.java:319) 12-31 21:01:26.711 3776 3776 E AndroidRuntime: at com.google.android.location.network.ConfirmAlertChimeraActivity.a(:com.google.android.gms:164) 12-31 21:01:26.711 3776 3776 E AndroidRuntime: at rzo.onServiceConnected(:com.google.android.gms:71) 12-31 21:01:26.711 3776 3776 E AndroidRuntime: at android.app.LoadedApk BadTokenException:Unabletoaddwindowtokenandroid.os.BinderProxy@f176911isnotvalid;isyouractivityrunning?123121:01:26.71137763776EAndroidRuntime:atandroid.view.ViewRootImpl.setView(ViewRootImpl.java:567)123121:01:26.71137763776EAndroidRuntime:atandroid.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:310)123121:01:26.71137763776EAndroidRuntime:atandroid.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)123121:01:26.71137763776EAndroidRuntime:atandroid.app.Dialog.show(Dialog.java:319)123121:01:26.71137763776EAndroidRuntime:atcom.google.android.location.network.ConfirmAlertChimeraActivity.a(:com.google.android.gms:164)123121:01:26.71137763776EAndroidRuntime:atrzo.onServiceConnected(:com.google.android.gms:71)123121:01:26.71137763776EAndroidRuntime:atandroid.app.LoadedApkServiceDispatcher.doConnected(LoadedApk.java:1223)




![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJlSzZSelNaVEY3YU4xUEdtRm4yQU80ZXBWUENZekxpYnJ6a01aM0JIZEtvOEkwUHJWRENpY1B4US82NDA_d3hfZm10PW90aGVy?x-oss-process=image/format,png)



Unable to add window -- token android.os.BinderProxy@f176911 is not valid; is your activity running



2.解决方案如下

--------



主要修改类:  

`frameworks/base/core/java/android/view/ViewRootImpl.java`



在 `ViewRootImpl`类中,解决恢复出厂设置后的问题,修改方案如下:



`public class ViewRootImpl extends AbsViewRootImpl implements ViewParent,              View.AttachInfo.Callbacks, ThreadedRenderer.DrawCallbacks {                   ... ...                       public void setView(View view, WindowManager.LayoutParams attrs, View panelParentView) {             synchronized (this) {                  if (mView == null) {                      mView = view;                 ... ...                       if (res < WindowManagerGlobal.ADD_OKAY) {                          mAttachInfo.mRootView = null;                          mAdded = false;                          mFallbackEventHandler.setView(null);                          unscheduleTraversals();                          setAccessibilityFocus(null, null);                          switch (res) {                              case WindowManagerGlobal.ADD_BAD_APP_TOKEN:                              case WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN:                                  // add by wangjie for com.google.android.gms.ui crash                                  int deviceProvisioned = android.provider.Settings.Global.getInt(mContext.getContentResolver(), android.provider.Settings.Global.DEVICE_PROVISIONED,0);                                  if(deviceProvisioned==0){                                     android.util.Log.e("wjwj","---ViewRootImpl GMS Crash---");                                     return;                                  }else{                                      throw new WindowManager.BadTokenException(                                           "Unable to add window -- token " + attrs.token                                           + " is not valid; is your activity running?");                                  }                                  // add by wangjie for com.google.android.gms.ui crash                              case WindowManagerGlobal.ADD_NOT_APP_TOKEN:                                  throw new WindowManager.BadTokenException(                                          "Unable to add window -- token " + attrs.token                                          + " is not for an application");                         ... ...                  }              }          }                   ... ...   }`



修改差异点如下



![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJvd0lXM2xBQzVxZENMaWJld29aZGljSFhONkJuZDdpYTJleGVzSFhZelNsVHIzalAwTUVudDZGaWFRLzY0MD93eF9mbXQ9b3RoZXI?x-oss-process=image/format,png)



Unable to add window -- token android.os.BinderProxy@f176911 is not valid; is your activity running?



三、setupwizard ConcurrentModificationException Crash

===================================================



1.Crash Log如下:

--------------



--------- beginning of crash 01-01 12:00:00.918 1583 1583 E AndroidRuntime: FATAL EXCEPTION: main 01-01 12:00:00.918 1583 1583 E AndroidRuntime: Process: com.google.android.setupwizard, PID: 1583 01-01 12:00:00.918 1583 1583 E AndroidRuntime: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.TIME_SET flg=0x25200010 } in com.google.android.setupwizard.time.DateTimeMonitor 1 @ 746560101 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t a n d r o i d . a p p . L o a d e d A p k 1@7465601 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.app.LoadedApk 1@7465601010112:00:00.91815831583EAndroidRuntime:atandroid.app.LoadedApkReceiverDispatcher A r g s . l a m b d a Args.lambda Args.lambda-android_app_LoadedApk R e c e i v e r D i s p a t c h e r ReceiverDispatcher ReceiverDispatcherArgs_52497(LoadedApk.java:1323) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.app.- L a m b d a Lambda LambdaaS31cHIhRx41653CMnd4gZqshIQ.$m 7 ( U n k n o w n S o u r c e : 4 ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t a n d r o i d . a p p . − 7(Unknown Source:4) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.app.- 7(UnknownSource:4)010112:00:00.91815831583EAndroidRuntime:atandroid.app.Lambda a S 31 c H I h R x 41653 C M n d 4 g Z q s h I Q . r u n ( U n k n o w n S o u r c e : 39 ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t a n d r o i d . o s . H a n d l e r . h a n d l e C a l l b a c k ( H a n d l e r . j a v a : 790 ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t a n d r o i d . o s . H a n d l e r . d i s p a t c h M e s s a g e ( H a n d l e r . j a v a : 99 ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t a n d r o i d . o s . L o o p e r . l o o p ( L o o p e r . j a v a : 164 ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t a n d r o i d . a p p . A c t i v i t y T h r e a d . m a i n ( A c t i v i t y T h r e a d . j a v a : 6523 ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( N a t i v e M e t h o d ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t c o m . a n d r o i d . i n t e r n a l . o s . R u n t i m e I n i t aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:790) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6523) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at com.android.internal.os.RuntimeInit aS31cHIhRx41653CMnd4gZqshIQ.run(UnknownSource:39)010112:00:00.91815831583EAndroidRuntime:atandroid.os.Handler.handleCallback(Handler.java:790)010112:00:00.91815831583EAndroidRuntime:atandroid.os.Handler.dispatchMessage(Handler.java:99)010112:00:00.91815831583EAndroidRuntime:atandroid.os.Looper.loop(Looper.java:164)010112:00:00.91815831583EAndroidRuntime:atandroid.app.ActivityThread.main(ActivityThread.java:6523)010112:00:00.91815831583EAndroidRuntime:atjava.lang.reflect.Method.invoke(NativeMethod)010112:00:00.91815831583EAndroidRuntime:atcom.android.internal.os.RuntimeInitMethodAndArgsCaller.run(RuntimeInit.java:438) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: Caused by: java.util.ConcurrentModificationException 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at java.util.ArrayList$Itr.next(ArrayList.java:860) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at com.google.android.setupwizard.time.DateTimeMonitor.updateStatus(DateTimeMonitor.java:134) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at com.google.android.setupwizard.time.DateTimeMonitor.-wrap0(Unknown Source:0) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at com.google.android.setupwizard.time.DateTimeMonitor 1. o n R e c e i v e ( D a t e T i m e M o n i t o r . j a v a : 73 ) 01 − 0112 : 00 : 00.91815831583 E A n d r o i d R u n t i m e : a t a n d r o i d . a p p . L o a d e d A p k 1.onReceive(DateTimeMonitor.java:73) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.app.LoadedApk 1.onReceive(DateTimeMonitor.java:73)010112:00:00.91815831583EAndroidRuntime:atandroid.app.LoadedApkReceiverDispatcher A r g s . l a m b d a Args.lambda Args.lambda-android_app_LoadedApk R e c e i v e r D i s p a t c h e r ReceiverDispatcher ReceiverDispatcherArgs_52497(LoadedApk.java:1313) 01-01 12:00:00.918 1583 1583 E AndroidRuntime: … 9 more --------- beginning of system




![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWI4dXF5eXdhMDJyN0pNdzI1eTlkVlNRT1o1Q3o1RHdxcjA2bHVpYTRoaWFlVUdvU1RqWmpadUxSUS82NDA_d3hfZm10PW90aGVy?x-oss-process=image/format,png)



ConcurrentModificationException



2.解决方案如下:

---------



此问题关键在于解决`ConcurrentModificationException`,但是没有`GMS`源码,只能尝试规避方案。  

修改类如下:  

`/frameworks/base/core/java/android/app/LoadedApk.java`



修改点如下:



public final class LoadedApk { ... ... final class Args extends BroadcastReceiver.PendingResult { public final Runnable getRunnable() { ... ... Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "broadcastReceiveReg"); try { ClassLoader cl = mReceiver.getClass().getClassLoader(); intent.setExtrasClassLoader(cl); intent.prepareToEnterProcess(); setExtrasClassLoader(cl); receiver.setPendingResult(this); receiver.onReceive(mContext, intent); } catch (Exception e) { if (mRegistered && ordered) { if (ActivityThread.DEBUG_BROADCAST) Slog.i(ActivityThread.TAG, "Finishing failed broadcast to " + mReceiver); sendFinished(mgr); } if (mInstrumentation == null || !mInstrumentation.onException(mReceiver, e)) { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); //setupwizard TIME_SET RuntimeException Crash if("android.intent.action.TIME_SET".equals(intent.getAction())){ if(mReceiver.toString().contains("com.google.android.setupwizard")){ android.util.Log.e("wjwj","---LoadedApk GMS setupwizard Crash---"); return; } } //setupwizard TIME_SET RuntimeException Crash throw new RuntimeException( "Error receiving broadcast " + intent + " in " + mReceiver, e); } } ... ... }; } } ... ... }




修改差异点如下:



![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJtNGxpYnJ3WWpMWFMxYXNtYjU2d0VLb3k2UWlhY3ZJaDF3YnNpY1dpY09rYWxYaWM5ZEhLWDM1TGZQQS82NDA_d3hfZm10PW90aGVy?x-oss-process=image/format,png)



throw new RuntimeException 异常没有被try-catch 导致crash



四、setupwizard ActivityNotFoundException Crash

=============================================



1.Crash Log如下:

--------------



--------- beginning of crash 12-12 15:19:11.984 1471 1471 E AndroidRuntime: FATAL EXCEPTION: main 12-12 15:19:11.984 1471 1471 E AndroidRuntime: Process: com.google.android.setupwizard, PID: 1471 12-12 15:19:11.984 1471 1471 E AndroidRuntime: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.wizard.NEXT (has extras) } 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1843) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1557) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4228) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4187) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at com.google.android.setupwizard.BaseActivity.startActivityForResult(BaseActivity.java:665) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at com.google.android.setupwizard.BaseActivity.nextAction(BaseActivity.java:651) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at com.google.android.setupwizard.BaseActivity.nextAction(BaseActivity.java:637) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at com.google.android.setupwizard.user.SuggestedActionsActivity.onItemSelected(SuggestedActionsActivity.java:226) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at com.android.setupwizardlib.items.RecyclerItemAdapter 1. o n C l i c k ( R e c y c l e r I t e m A d a p t e r . j a v a : 106 ) 12 − 1215 : 19 : 11.98414711471 E A n d r o i d R u n t i m e : a t a n d r o i d . v i e w . V i e w . p e r f o r m C l i c k ( V i e w . j a v a : 5624 ) 12 − 1215 : 19 : 11.98414711471 E A n d r o i d R u n t i m e : a t a n d r o i d . v i e w . V i e w 1.onClick(RecyclerItemAdapter.java:106) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at android.view.View.performClick(View.java:5624) 12-12 15:19:11.984 1471 1471 E AndroidRuntime: at android.view.View 1.onClick(RecyclerItemAdapter.java:106)121215:19:11.98414711471EAndroidRuntime:atandroid.view.View.performClick(View.java:5624)121215:19:11.98414711471EAndroidRuntime:atandroid.view.ViewPerformClick.run(View.java:22285)




![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWIwWnROSDROU3MwQmJ6dXFGWGVCZGI4S3dOd3VHaHF0ZmtOdjBKek00OE9pYUMxT2VBOVJ0cGlhdy82NDA_d3hfZm10PW90aGVy?x-oss-process=image/format,png)



com.google.android.setupwizard 报错log



2.解决方案如下:

---------



在`Instrumentation`类中对`Google`开机向导进行特殊处理。  

主要修改类如下:  

`/frameworks/base/core/java/android/app/Instrumentation.java`  

主要修改方案如下:



public class Instrumentation { … … /** @hide */ public static void checkStartActivityResult(int res, Object intent) { if (!ActivityManager.isStartResultFatalError(res)) { return; } switch (res) { case ActivityManager.START_INTENT_NOT_RESOLVED: case ActivityManager.START_CLASS_NOT_FOUND: if (intent instanceof Intent && ((Intent)intent).getComponent() != null) throw new ActivityNotFoundException( "Unable to find explicit activity class " + ((Intent)intent).getComponent().toShortString() + “; have you declared this activity in your AndroidManifest.xml?”); //GMS Setupwizard ActivityNotFoundException Crash if(“com.android.wizard.NEXT”.equals(((Intent)intent).getAction())){ android.util.Log.e(“wjwj”,"Instrumentation GMS Setupwizard Crash "); return; } //GMS Setupwizard ActivityNotFoundException Crash throw new ActivityNotFoundException( "No Activity found to handle " + intent); case ActivityManager.START_PERMISSION_DENIED: throw new SecurityException("Not allowed to start activity " + intent); case ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT: throw new AndroidRuntimeException( “FORWARD_RESULT_FLAG used while also requesting a result”); case ActivityManager.START_NOT_ACTIVITY: throw new IllegalArgumentException( “PendingIntent is not an activity”); … … } } … … }




主要修改差异点如下:



![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJYcmtGMVVpYzZpYzRnRmliZUhDVnlnZFRzdExuVUlOMVFYWTlpYUN3VG5rdVpkT2RmNWVCNWNuWnRRLzY0MD93eF9mbXQ9b3RoZXI?x-oss-process=image/format,png)



Instrumentation 类中对Google 开机向导进行特殊处理下



五、setupwizard On-body ActivityNotFoundException Crash

=====================================================



1.Crash Log如下:

--------------



--------- beginning of crash 12-31 19:00:26.668 2010 2010 E AndroidRuntime: FATAL EXCEPTION: main 12-31 19:00:26.668 2010 2010 E AndroidRuntime: Process: com.google.android.setupwizard, PID: 2010 12-31 19:00:26.668 2010 2010 E AndroidRuntime: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.gms/com.google.android.gms.trustagent.discovery.OnbodyPromotionActivity}; have you declared this activity in your AndroidManifest.xml? 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4229) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4188) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at com.google.android.setupwizard.BaseActivity.startActivityForResult(BaseActivity.java:665) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at com.google.android.setupwizard.BaseActivity.startFirstRunActivityForResult(BaseActivity.java:719) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at com.google.android.setupwizard.user.SuggestedActionsActivity.onItemSelected(SuggestedActionsActivity.java:217) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at com.android.setupwizardlib.items.RecyclerItemAdapter 1. o n C l i c k ( R e c y c l e r I t e m A d a p t e r . j a v a : 106 ) 12 − 3119 : 00 : 26.66820102010 E A n d r o i d R u n t i m e : a t a n d r o i d . v i e w . V i e w . p e r f o r m C l i c k ( V i e w . j a v a : 5675 ) 12 − 3119 : 00 : 26.66820102010 E A n d r o i d R u n t i m e : a t a n d r o i d . v i e w . V i e w 1.onClick(RecyclerItemAdapter.java:106) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.view.View.performClick(View.java:5675) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.view.View 1.onClick(RecyclerItemAdapter.java:106)123119:00:26.66820102010EAndroidRuntime:atandroid.view.View.performClick(View.java:5675)123119:00:26.66820102010EAndroidRuntime:atandroid.view.ViewPerformClick.run(View.java:22641) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:836) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:103) 12-31 19:00:26.668 2010 2010 E AndroidRuntime: at android.os.Looper.loop(Looper.java:203)




![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJnTFBTT2FQUlpXdnp3aDdjbDQ1SGVyY1llQkdGY3EyaWN4RVZYeWxDcFZGTjdZZmxWVHVDOHdBLzY0MD93eF9mbXQ9b3RoZXI?x-oss-process=image/format,png)



Unable to find explicit activity class Log



2.解决方案如下:

---------



![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWIzZkFLUFBPcEZJME94R2NHT3o2TEU0aWJVaWFrcnJhNjhoUmhEbThlWUhPeUFNWGxJbTNCTmxiQS82NDA_d3hfZm10PW90aGVy?x-oss-process=image/format,png)



com.google.android.setupwizard 解决方案



六、Google play Service NullPointerException Crash

================================================



1.Crash log

-----------



`Google play Service` 空指针的`Log`由于目前没有找到,后续补上。



2.解决方案如下:

---------



主要修改类:  

`frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java`  

修改方法如下:



public class PackageManagerService extends PackageManagerServiceExAbs implements PackageSender { /** * Important: The provided filterCallingUid is used exclusively to filter out activities * that can be seen based on user state. It's typically the original caller uid prior * to clearing. Because it can only be provided by trusted code, it's value can be * trusted and will be used as-is; unlike userId which will be validated by this method. */ private ActivityInfo getActivityInfoInternal(ComponentName component, int flags, int filterCallingUid, int userId) { boolean isAppClone = false; if (component != null && AppCloneUserInfo.containsCloneTag(component.getPackageName())) { userId = AppCloneUserInfo.getUserIdFromCloneTag(component.getPackageName(), userId); final String packageName = AppCloneUserInfo.removeCloneTag(component.getPackageName()); final String className = component.getClassName(); component = new ComponentName(packageName, className); isAppClone = true; } if (!sUserManager.exists(userId)) return null; flags = updateFlagsForComponent(flags, userId, component); enforceCrossUserPermission(Binder.getCallingUid(), userId, false /* requireFullPermission */, false /* checkShell */, "get activity info"); synchronized (mPackages) { PackageParser.Activity a = mActivities.mActivities.get(component); if (DEBUG_PACKAGE_INFO) Log.v(TAG, "getActivityInfo " + component + ": " + a); if (a != null) { // SPRD: Add for AppClone (Components), generate activity info of owner. int lastUserId = userId; if(!mSettings.isEnabledAndMatchLPr(a.info, flags, userId)) { lastUserId = AppCloneUserInfo.adjustAppCloneUserId( a.info.applicationInfo, userId); } if (mSettings.isEnabledAndMatchLPr(a.info, flags, lastUserId)) { PackageSetting ps = mSettings.mPackages.get(component.getPackageName()); if (ps == null) return null; if (filterAppAccessLPr(ps, filterCallingUid, component, TYPE_ACTIVITY, lastUserId)) { return null; } /* SPRD: modify to distinguish package of appclone @{ */ /*return PackageParser.generateActivityInfo(a, flags, ps.readUserState(userId), userId);*/ ActivityInfo info = PackageParser.generateActivityInfo(a, flags, ps.readUserState(lastUserId), lastUserId); if (info != null && isAppClone) { info.packageName = AppCloneUserInfo.addCloneTag(info.packageName, lastUserId); } return info; /* @} */ } } // GMS Google play Service NullPointerException Crash if (null != mResolveComponentName && mResolveComponentName.equals(component)) { android.util.Log.e("wjwj","PackageManageServices GMS Google play Service NullPointerException Crash "); // GMS Google play Service NullPointerException Crash /* SPRD: modify to distinguish package of appclone @{ */ /*return PackageParser.generateActivityInfo( mResolveActivity, flags, new PackageUserState(), userId);*/ ActivityInfo info = PackageParser.generateActivityInfo( mResolveActivity, flags, new PackageUserState(), userId); if (info != null && isAppClone) { info.packageName = AppCloneUserInfo.addCloneTag(info.packageName, userId); } return info; /* @} */ } } return null; } }




Google play Service NullPointerException Crash主要修改点如下:



![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJ1YU5RNmRMc3lUOENGUkx4R0kxU29VU2JzaFlnbnY3OXpCcDlzaWJ3N2FpYnJHeHVpY3R0aWNjeGNRLzY0MD93eF9mbXQ9b3RoZXI?x-oss-process=image/format,png)



Google play Service NullPointerException Crash主要修改点



七、恢复出厂设置或者第一次开机,先闪壁纸再显示开机向导

===========================



1.解决方案如下:

---------



主要修改`KeyguardServiceDelegate`这个类。  

`frameworks/base/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java`



*   1.修改点1:

    



在此类中添加判断方法,获取手机`DEVICE_PROVISIONED`状态信息。



![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJSR2puU0NYaWFKb0hhQnRGVmZWdkwzUklzNlhqaWJmeTFtUHN0Y1J3bU1MaWNGb3ZEN3NqYndnUUEvNjQwP3d4X2ZtdD1vdGhlcg?x-oss-process=image/format,png)



在此类中添加判断方法



*   2.修改点2:  

    



此类的构造方法中,如果获取到的为true,先隐藏



![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJMVUNrR2JHWVZOU2VsSmM2WkNOZm1oUGpPQXhWdFh6Q3VINUxFUFNwbmhUT3VxblRNSklZREEvNjQwP3d4X2ZtdD1vdGhlcg?x-oss-process=image/format,png)



此类的构造方法中,如果获取到的为true,先隐藏



![img](https://img-blog.csdnimg.cn/img_convert/c1d741d116c4e9bf6d095435402c3e21.png)
![img](https://img-blog.csdnimg.cn/img_convert/ca9301197243f7a126ce5dacfccc2004.png)
![img](https://img-blog.csdnimg.cn/img_convert/dffadd1ea9b1d02401bce8332ebf314e.png)

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[如果你需要这些资料,可以戳这里获取](https://bbs.csdn.net/topics/618658159)**

藏



[外链图片转存中...(img-AQYtIHGN-1715400621282)]
[外链图片转存中...(img-LnXan5Vh-1715400621283)]
[外链图片转存中...(img-2uRVM4zf-1715400621283)]

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[如果你需要这些资料,可以戳这里获取](https://bbs.csdn.net/topics/618658159)**

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值