Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yaeio opened this issue Jun 28, 2018 · 10 comments

Comments

@yaeio
Copy link

yaeio commented Jun 28, 2018

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
Copy link
Author

yaeio commented Jun 28, 2018

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

@rk700
Copy link
Member

rk700 commented Jul 2, 2018

试下最新的commit ce83f47

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

@yaeio
Copy link
Author

yaeio commented Jul 2, 2018

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

@rk700
Copy link
Member

rk700 commented Jul 3, 2018

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

@yaeio
Copy link
Author

yaeio commented Jul 3, 2018

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

@yaeio
Copy link
Author

yaeio commented Jul 3, 2018

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

@rk700
Copy link
Member

rk700 commented Jul 3, 2018

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

@yaeio
Copy link
Author

yaeio commented Jul 3, 2018

// 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,我这边试了还是一样的问题,还是我理解错了

@sarinregmi
Copy link

sarinregmi commented May 6, 2019

any updates on this issue ? @yaeio

@Carlyle-Lee
Copy link

same issue on xiaomi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants