YAHFA icon indicating copy to clipboard operation
YAHFA copied to clipboard

被Hook的方法执行多次后会抛出 java.lang.IncompatibleClassChangeError

Open yaeio opened this issue 6 years ago • 10 comments

java.lang.IncompatibleClassChangeError: The method '原始方法的信息' was expected to be of type static but instead was found to be of type virtual (declaration of '这里是hook方法的信息' appears in /storage/emulated/0/demoPlugin-debug.apk) 机型小米6 android8.0 已经加你QQ请通过一下

yaeio avatar Jun 28 '18 08:06 yaeio

看了你博客的技术文章,说是通过清除 hotness_count_值来防止,但是实际上好像这个问题依旧存在,直接跑demo在androidO for 循环执行hook 很快就崩溃

yaeio avatar Jun 28 '18 10:06 yaeio

试下最新的commit https://github.com/rk700/YAHFA/commit/ce83f47a8f0af54cf51e4858ced4319361dd51ae

通过kAccCompileDontBother指定方法不编译,arm和aarch64的trampoline代码没有测试

rk700 avatar Jul 02 '18 10:07 rk700

能简单说下这里问题在哪吗,我这边想继续跟进测试 想交流一下我的QQ 211275834

yaeio avatar Jul 02 '18 10:07 yaeio

可见相关说明 https://github.com/rk700/YAHFA/wiki/%E6%9B%B4%E6%96%B0%E8%AF%B4%E6%98%8E

rk700 avatar Jul 03 '18 01:07 rk700

小米5(7.0) 小米6(8.0)测试,android 7.0上面 调用30——40次(for循环执行的话定个一万次调用,几千次时候就无法执行了)后就无法调用hook函数了只执行原函数,8.0上稳定可以调用原函数和hook函数

yaeio avatar Jul 03 '18 03:07 yaeio

android 6.0 360手机初测,方法findandhook这一步时候崩溃 正在换其它6.0手机跟测

yaeio avatar Jul 03 '18 04:07 yaeio

Android 7.0试下把target method的access flag添加kAccNative

rk700 avatar Jul 03 '18 06:07 rk700

// set the target method to native so that Android O wouldn't invoke it with interpreter if(SDKVersion >= ANDROID_N) { int access_flags = read32((char *) targetMethod + OFFSET_access_flags_in_ArtMethod); LOGI("access flags is 0x%x", access_flags); access_flags |= kAccNative; memcpy( (char *) targetMethod + OFFSET_access_flags_in_ArtMethod, &access_flags, 4 ); }

是指的这样吗,把设置kAccNative的范围扩大到Android_N,我这边试了还是一样的问题,还是我理解错了

yaeio avatar Jul 03 '18 07:07 yaeio

any updates on this issue ? @yaeio

sarinregmi avatar May 06 '19 02:05 sarinregmi

same issue on xiaomi

Carlyle-Lee avatar Oct 16 '19 06:10 Carlyle-Lee