-
Notifications
You must be signed in to change notification settings - Fork 351
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
android7.0和android7.1的模拟器出现java.lang.IncompatibleClassChangeError #9
Comments
Android N下面有比较多的坑,所以还只是试验性质 |
目前通过对比android6.0和android7.0的源码: 以下是android7.0 runtime的class_linker.cc源码 |
看了下Android 6.0上的 那么问题应该就是Android N的混合编译造成的。Android N的应用在安装时使用的是解释模式,运行过程中可能还会有有编译的过程。所以在应用运行一段时间后,也会有调用到 hook绕过检查感觉确实不太好做,正如所说,是inline的 不过Android N上在应用运行时加载的dex,是编译而非解释的,所以同样的操作放到VirtualHook中应该就不会出现,可以试验下 |
hook了ThrowIncompatibleClassChangeError方法强制绕过后,后面还是存在调用匹配检查, |
1、初步测试了通过DexClassLoader动态加载apk/dex的方式去hook后: 2、目前初步估计使用public static void origin(Toast toast) { }方式来保存原方法的句柄在android7.0以上的系统可能会导致: |
没有试过用legend的方式在android 7.0上做hook,可以试验一下 |
与 #8 重复 |
测试环境:
android7.0 armeabi模拟器/android7.1 x86模拟器。
多次执行Toast.show方法后出现如下java.lang.IncompatibleClassChangeError异常,然后程序退出
05-24 04:13:43.362: W/YAHFA(1439): hook end
05-24 04:13:43.366: W/YAHFA(1439): hook
05-24 04:13:43.367: W/YAHFA(1439): hook end
05-24 04:13:43.367: I/Choreographer(1439): Skipped 42 frames! The application may be doing too much work on its main thread.
05-24 04:13:44.462: W/YAHFA(1439): hook
05-24 04:13:44.467: D/AndroidRuntime(1439): Shutting down VM
05-24 04:13:44.472: E/AndroidRuntime(1439): FATAL EXCEPTION: main
05-24 04:13:44.472: E/AndroidRuntime(1439): Process: lab.galaxy.yahfa.demoApp, PID: 1439
05-24 04:13:44.472: E/AndroidRuntime(1439): java.lang.IncompatibleClassChangeError: The method 'void android.widget.Toast.show()' was expected to be of type static but instead was found to be of type virtual (declaration of 'com.yunshouhu.hookitem.Hook_Toast_show' appears in /data/app/lab.galaxy.yahfa.demoApp-1/base.apk)
05-24 04:13:44.472: E/AndroidRuntime(1439): at com.yunshouhu.hookitem.Hook_Toast_show.hook(Hook_Toast_show.java:19)
05-24 04:13:44.472: E/AndroidRuntime(1439): at com.yunshouhu.MainActivity$4.onClick(MainActivity.java:88)
05-24 04:13:44.472: E/AndroidRuntime(1439): at android.view.View.performClick(View.java:5610)
05-24 04:13:44.472: E/AndroidRuntime(1439): at android.view.View$PerformClick.run(View.java:22260)
05-24 04:13:44.472: E/AndroidRuntime(1439): at android.os.Handler.handleCallback(Handler.java:751)
05-24 04:13:44.472: E/AndroidRuntime(1439): at android.os.Handler.dispatchMessage(Handler.java:95)
05-24 04:13:44.472: E/AndroidRuntime(1439): at android.os.Looper.loop(Looper.java:154)
05-24 04:13:44.472: E/AndroidRuntime(1439): at android.app.ActivityThread.main(ActivityThread.java:6077)
05-24 04:13:44.472: E/AndroidRuntime(1439): at java.lang.reflect.Method.invoke(Native Method)
05-24 04:13:44.472: E/AndroidRuntime(1439): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
05-24 04:13:44.472: E/AndroidRuntime(1439): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
05-24 04:13:44.515: W/ActivityManager(378): Force finishing activity lab.galaxy.yahfa.demoApp/com.yunshouhu.MainActivity
The text was updated successfully, but these errors were encountered: