Open xalexchen opened 8 years ago
plz refer https://github.com/alibaba/dexposed/blob/master/dexposed/src/main/java/com/taobao/android/dexposed/DexposedBridge.java#L222 and https://github.com/alibaba/dexposed/blob/master/dexposed/src/main/java/com/taobao/android/dexposed/DexposedBridge.java#L256 when before and after method occur exception,it should be catched!
and if the orignal method crash,it only try catch InvocationTargetException,(https://github.com/alibaba/dexposed/blob/master/dexposed/src/main/java/com/taobao/android/dexposed/DexposedBridge.java#L243), so you should try catch your exception in your orignal method.
what i means is if the target method has try-catch blocked. will directly crash VM
example :
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { String a = null; try { a.toString(); } catch (Exception e) { e.printStackTrace(); } Log.i("dexposed", "before"); } as you can see,we already try-catch null point exception.but when VM try to fillStackTrace will lead VM directly crashed. make sense and any help ? and the Crash log like this :
backtrace:
12-22 14:32:55.134 I/DEBUG ( 424): #00 pc 002324ee /system/lib/libart.so (art::CountStackDepthVisitor::VisitFrame()+297)
12-22 14:32:55.134 I/DEBUG ( 424): #01 pc 0022da3d /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+272)
12-22 14:32:55.135 I/DEBUG ( 424): #02 pc 002388d9 /system/lib/libart.so (_jobject* art::Thread::CreateInternalStackTrace
Could you tell me your phone type,and the android verison?
nexus 5 . android 5.0
1.when i hook a method which inside has try-catch blocked,when catch blocked raise will lead app directly crash.