asLody/whale

null receiver problem

Closed this issue · 3 comments

java.lang.NullPointerException: null receiver
02-26 22:51:23.068 E/AndroidRuntime(31196): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3000)
02-26 22:51:23.068 E/AndroidRuntime(31196): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3104)
02-26 22:51:23.068 E/AndroidRuntime(31196): at android.app.ActivityThread.-wrap12(Unknown Source:0)
02-26 22:51:23.068 E/AndroidRuntime(31196): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1756)
02-26 22:51:23.068 E/AndroidRuntime(31196): at android.os.Handler.dispatchMessage(Handler.java:106)
02-26 22:51:23.068 E/AndroidRuntime(31196): at android.os.Looper.loop(Looper.java:164)
02-26 22:51:23.068 E/AndroidRuntime(31196): at android.app.ActivityThread.main(ActivityThread.java:6905)
02-26 22:51:23.068 E/AndroidRuntime(31196): at java.lang.reflect.Method.invoke(Native Method)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:820)
02-26 22:51:23.068 E/AndroidRuntime(31196): Caused by: java.lang.NullPointerException: null receiver
02-26 22:51:23.068 E/AndroidRuntime(31196): at java.lang.reflect.Method.invoke(Native Method)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.lody.whale.WhaleRuntime.invokeOriginalMethodNative(Native Method)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.lody.whale.xposed.XposedBridge.invokeOriginalMethod(XposedBridge.java:293)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.lody.whale.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:238)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.lody.whale.WhaleRuntime.handleHookedMethod(WhaleRuntime.java:53)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.hellobike.publicbundle.logger.Logger.d(Native Method)
02-26 22:51:23.068 E/AndroidRuntime(31196): at com.hellobike.atlas.application.AppLifecycleCallback.onActivityCreated(AppLifecycleCallback.java:21)

作者在hook方法时忘记把原方法的access_flags赋值给ArtHookParam的origin_access_flags属性了,导致MovingGC之后,Clone新的ArtMethod时静态方法转变为了非静态方法。在art_runtime.cc文件的HookMethod方法中加上param->origin_access_flags = hooked_method.GetAccessFlags();就OK了

作者在hook方法时忘记把原方法的access_flags赋值给ArtHookParam的origin_access_flags属性了,导致MovingGC之后,Clone新的ArtMethod时静态方法转变为了非静态方法。在art_runtime.cc文件的HookMethod方法中加上param->origin_access_flags = hooked_method.GetAccessFlags();就OK了

感谢,自己编译测试了一下,完美!