GithubHelp home page GithubHelp logo

legend's Introduction

Legend


logo

Projects are out of date, plese move to:

Whale Hook

What is Legend?

Legend is a Hook framework for Android Development, it allows you to Hook Java methods without ROOT. Even more exciting is that it supports both Dalvik and Art environment!

https://github.com/asLody/legend

1. What is the good

  • Programming more efficient
  • Dynamic debugging
  • HotFix and needn't reboot app
  • Fast dump Dex File in the shell
  • Software security penetration
  • Do some exciting things...

2. How to use

Example 1: Annotation type Hook

@Hook("android.widget.Toast::show")
public static void Toast_show(Toast thiz) {
  thiz.setText("XXXXXXXXX");
  //Call the origin method
  HookManager.getDefault().callSuper(thiz);
}

Example 2: Interception of startActivity

@Hook("android.app.Activity::[email protected]")
public static void Activity_startActivity(Activity thiz, Intent intent) {
  if (!ALLOW_LAUNCH_ACTIVITY) {
    Toast.makeText(thiz, "I am sorry to turn your Activity down :)", Toast.LENGTH_SHORT).show();
  } else {
    HookManager.getDefault().callSuper(thiz, intent);
  }
}

Notice:

  • Write the following code down in where you want to your hooks enable.
HookManager.getDefault().applyHooks(YourClass.class);
  • You can also hook a method without annotation.
HookManager.getDefault().hookMethod(originMethod, hookMethod);

3. Compatibility

  • Dalvik & Android 4.2
  • Dalvik & Android 4.3
  • Art & Android 5.0
  • Art & Android 5.0.1
  • Art & Android 5.1
  • Art & Android 6.0
  • Art & Android 6.0.1
  • aliyunOS VM

4. Showcase

https://github.com/dodola/RocooFix

5. Help improve Legend

if (Country.China == your.country) {
  QQGroup.join(530497973);
} else {
  webView.loadUrl("https://github.com/asLody/legend/issues");
}

6. Author

Lody

legend's People

Contributors

aslody avatar finallody avatar zhangyiran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

legend's Issues

Runtime Error : Failed to find Dex offset for PC offset(LG G2 Android 5.0.1)

01-15 12:16:57.902 15445-15445/? I/art: Late-enabling -Xcheck:jni
01-15 12:16:58.007 15445-15445/com.legend.demo I/InstantRun: Instant Run Runtime started. Android package is com.legend.demo, real application class is com.legend.demo.App.
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd72ec
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd7308
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd72e8
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd72dc
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da20
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da24
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da00
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da08
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da0c
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da18
01-15 12:16:58.111 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da38
01-15 12:16:58.112 15445-15445/com.legend.demo D/#######: Malloc memory, size : 144
01-15 12:16:58.112 15445-15445/com.legend.demo D/#######: Write Memory to 0xffffffffb50d8000
01-15 12:16:58.112 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081da40
01-15 12:16:58.113 15445-15445/com.legend.demo D/Legend-Log: [+++] Activity_startActivity have hooked.
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd78bc
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd78d8
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd78b8
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dd78ac
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebbe8
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebbec
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebbc8
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebbd0
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebbd4
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebbe0
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebc00
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Malloc memory, size : 144
01-15 12:16:58.126 15445-15445/com.legend.demo D/#######: Write Memory to 0xffffffffb3522000
01-15 12:16:58.127 15445-15445/com.legend.demo D/#######: Write Memory to 0x704ebc08
01-15 12:16:58.127 15445-15445/com.legend.demo D/Legend-Log: [+++] Application_onCreate have hooked.
01-15 12:16:58.142 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda47c
01-15 12:16:58.142 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda498
01-15 12:16:58.142 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda478
01-15 12:16:58.142 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda46c
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f860
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f864
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f840
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f848
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f84c
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f858
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f878
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Malloc memory, size : 144
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0xffffffffb34dd000
01-15 12:16:58.143 15445-15445/com.legend.demo D/#######: Write Memory to 0x7081f880
01-15 12:16:58.143 15445-15445/com.legend.demo D/Legend-Log: [+++] TelephonyManager_getSimSerialNumber have hooked.
01-15 12:16:58.153 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda4cc
01-15 12:16:58.153 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda4e8
01-15 12:16:58.153 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda4c8
01-15 12:16:58.153 15445-15445/com.legend.demo D/#######: Write Memory to 0x75dda4bc
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x70778150
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x70778154
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x70778130
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x70778138
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x7077813c
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x70778148
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x70778168
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Malloc memory, size : 144
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0xffffffffb34ad000
01-15 12:16:58.154 15445-15445/com.legend.demo D/#######: Write Memory to 0x70778170
01-15 12:16:58.154 15445-15445/com.legend.demo D/Legend-Log: [+++] Toast_show have hooked.
01-15 12:16:58.158 15445-15445/com.legend.demo A/art: art/runtime/mirror/art_method.cc:199] Failed to find Dex offset for PC offset 0xc06b6056(PC 0x73b79577, entry_point=0xb34c3521) in void com.legend.demo.App.Application_onCreate(android.app.Application)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] Runtime aborting...
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] Aborting thread:
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] "main" prio=5 tid=1 Runnable
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | group="" sCount=0 dsCount=0 obj=0x750ef068 self=0xb4827800
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | sysTid=15445 nice=0 cgrp=apps sched=0/0 handle=0xb6fdfec8
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | state=R schedstat=( 0 0 0 ) utm=10 stm=4 core=2 HZ=100
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | stack=0xbe338000-0xbe33a000 stackSize=8MB
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | held mutexes= "abort lock" "mutator lock"(shared held)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #00 pc 000045b4 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #1 pc 00002e1d /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #2 pc 00252d6d /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits >&, int, char const*, art::mirror::ArtMethod*)+84)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #3 pc 00236aeb /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits >&) const+162)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #4 pc 00226615 /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits >&, art::Thread*)+32)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 0022687f /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits >&)+354)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #6 pc 00226a77 /system/lib/libart.so (art::Runtime::Abort()+82)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #7 pc 000a6bb9 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #8 pc 001e3e65 /system/lib/libart.so (art::mirror::ArtMethod::ToDexPc(unsigned int, bool)+1064)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #9 pc 00295831 /system/lib/libart.so (artQuickResolutionTrampoline+1152)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #10 pc 000a269b /system/lib/libart.so (art_quick_resolution_trampoline+10)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #11 pc 000e80fc /dev/ashmem/dalvik-main space (deleted) (???)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.legend.demo.App.Application_onCreate(App.java:-1)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.LoadedApk.makeApplication(LoadedApk.java:585)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4584)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.access$1500(ActivityThread.java:149)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Handler.dispatchMessage(Handler.java:102)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Looper.loop(Looper.java:135)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.main(ActivityThread.java:5290)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke!(Native method)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke(Method.java:372)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] Dumping all threads without appropriate locks held: thread list lock
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] All threads:
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] DALVIK THREADS (13):
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] "main" prio=5 tid=1 Runnable
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | group="" sCount=0 dsCount=0 obj=0x750ef068 self=0xb4827800
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | sysTid=15445 nice=0 cgrp=apps sched=0/0 handle=0xb6fdfec8
01-15 12:16:58.350 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | state=R schedstat=( 0 0 0 ) utm=12 stm=5 core=2 HZ=100
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | stack=0xbe338000-0xbe33a000 stackSize=8MB
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | held mutexes= "abort lock" "mutator lock"(shared held)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #00 pc 000045b4 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #1 pc 00002e1d /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #2 pc 00252d6d /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits >&, int, char const*, art::mirror::ArtMethod*)+84)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #3 pc 00236aeb /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits >&) const+162)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #4 pc 0023f9dd /system/lib/libart.so (art::ThreadList::DumpLocked(std::__1::basic_ostream<char, std::__1::char_traits >&)+120)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 0022682d /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits >&)+272)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #6 pc 00226a77 /system/lib/libart.so (art::Runtime::Abort()+82)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #7 pc 000a6bb9 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #8 pc 001e3e65 /system/lib/libart.so (art::mirror::ArtMethod::ToDexPc(unsigned int, bool)+1064)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #9 pc 00295831 /system/lib/libart.so (artQuickResolutionTrampoline+1152)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #10 pc 000a269b /system/lib/libart.so (art_quick_resolution_trampoline+10)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #11 pc 000e80fc /dev/ashmem/dalvik-main space (deleted) (???)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.legend.demo.App.Application_onCreate(App.java:-1)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.LoadedApk.makeApplication(LoadedApk.java:585)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4584)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.access$1500(ActivityThread.java:149)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Handler.dispatchMessage(Handler.java:102)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Looper.loop(Looper.java:135)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.main(ActivityThread.java:5290)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke!(Native method)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke(Method.java:372)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284]
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] "Heap thread pool worker thread 0" prio=5 tid=2 Native (still starting up)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | group="" sCount=0 dsCount=0 obj=0x0 self=0xaf433400
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | sysTid=15451 nice=0 cgrp=apps sched=0/0 handle=0xb4904580
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2 HZ=100
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | stack=0xb417f000-0xb4181000 stackSize=1020KB
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | held mutexes=
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #00 pc 000101ec /system/lib/libc.so (syscall+28)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #1 pc 000a98f3 /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+98)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #2 pc 00240c85 /system/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+64)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #3 pc 00240c1f /system/lib/libart.so (art::ThreadPoolWorker::Run()+62)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #4 pc 0024150d /system/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+60)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 0001397b /system/lib/libc.so (__pthread_start(void*)+30)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #6 pc 0001196b /system/lib/libc.so (__start_thread+6)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] (no managed stack frames)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284]
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] "Heap thread pool worker thread 2" prio=5 tid=3 Native (still starting up)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | group="" sCount=0 dsCount=0 obj=0x0 self=0xa999ac00
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | sysTid=15453 nice=0 cgrp=apps sched=0/0 handle=0xb4904080
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2 HZ=100
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | stack=0xb3f7d000-0xb3f7f000 stackSize=1020KB
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | held mutexes=
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #00 pc 000101ec /system/lib/libc.so (syscall+28)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #1 pc 000a98f3 /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+98)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #2 pc 00240c85 /system/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+64)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #3 pc 00240c1f /system/lib/libart.so (art::ThreadPoolWorker::Run()+62)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #4 pc 0024150d /system/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+60)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 0001397b /system/lib/libc.so (__pthread_start(void*)+30)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #6 pc 0001196b /system/lib/libc.so (__start_thread+6)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] (no managed stack frames)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284]
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] "Heap thread pool worker thread 1" prio=5 tid=4 Native (still starting up)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | group="" sCount=0 dsCount=0 obj=0x0 self=0xaf434400
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | sysTid=15452 nice=0 cgrp=apps sched=0/0 handle=0xb4904800
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2 HZ=100
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | stack=0xb407f000-0xb4081000 stackSize=1020KB
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] | held mutexes=
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #00 pc 000101ec /system/lib/libc.so (syscall+28)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #1 pc 000a98f3 /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+98)
01-15 12:16:58.352 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #2 pc 00240c85 /system/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+64)
01-15 12:16:58.353 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #3 pc 00240c1f /system/lib/libart.so (art::ThreadPoolWorker::Run()+62)
01-15 12:16:58.353 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #4 pc 0024150d /system/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+60)
01-15 12:16:58.353 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 0001397b /system/lib/libc.so (__pthread_start(void*)+30)
01-15 12:16:58.353 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #6 pc 0001196b /system/lib/libc.so (__start_thread+6)
01-15 12:16:58.353 15445-15445/com.legend.demo A/art: art/runtime/runtime.cc:284] (no managed stack frames)

java.lang.IncompatibleClassChangeError

    try {
        Method originMethod = View.class.getDeclaredMethod("requestLayout");
        Method hookMethod = Profiling.class.getDeclaredMethod("requestLayoutHook", Object.class);
        HookManager.getDefault().hookMethod(originMethod, hookMethod);
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }

。。。。。。

public static void requestLayoutHook(Object view) {
    HookManager.getDefault().callSuper(view);
}

此时在有些调用requestlayout的地方,会有以下异常
java.lang.IncompatibleClassChangeError:

运行sample就报错java.lang.VerifyError

手机是【三星GALAXY S5 G9009D】
09-05 15:20:10.738 23232-23232/com.legend.demo D/AndroidRuntime: Shutting down VM 09-05 15:20:10.748 23232-23232/com.legend.demo E/AndroidRuntime: FATAL EXCEPTION: main Process: com.legend.demo, PID: 23232 java.lang.VerifyError: Verifier rejected class com.legend.demo.MainActivity$4 due to bad method void com.legend.demo.MainActivity$4.onClick(android.view.View) (declaration of 'com.legend.demo.MainActivity$4' appears in /data/app/com.legend.demo-1/split_lib_slice_1_apk.apk) at com.legend.demo.MainActivity.onCreate(MainActivity.java:61) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7225) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

hook不到TextView的setText方法

老铁求救啊 我hook了 TextView的setText方法 由于他会自动调用public的这个方法
public final void setText(CharSequence text) {
setText(text, mBufferType);
}
我hook这个方法
public void setText(CharSequence text, BufferType type) {
setText(text, type, true, 0);

    if (mCharWrapper != null) {
        mCharWrapper.mChars = null;
    }
}

但是没有作用 求教
@hook("android.widget.TextView::[email protected]")
public static void TextView_setText(TextView view, CharSequence text , TextView.BufferType type) {

    Log.v(TAG,"this is text" );
    text = "sss";
    HookManager.getDefault().callSuper(view,text,type);
}

三星GT-19507V Android5.0.1 crash

07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] Throwing new exception 'length=643; index=51516434' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=77951; index=51516434
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at java.lang.String java.lang.reflect.ArtMethod.getNameNative!() (ArtMethod.java:-2)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at java.lang.String java.lang.reflect.ArtMethod.getMethodName(java.lang.reflect.ArtMethod) (ArtMethod.java:136)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at java.lang.String java.lang.reflect.Method.getName() (Method.java:139)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void com.lody.legend.HookManager.applyHooks(java.lang.Class) (HookManager.java:93)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void com.legend.demo.App.attachBaseContext(android.content.Context) (App.java:25)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[], boolean) (Method.java:-2)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:372)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(android.content.Context) (BootstrapApplication.java:248)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void android.app.Application.attach(android.content.Context) (Application.java:205)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at android.app.Application android.app.Instrumentation.newApplication(java.lang.Class, android.content.Context) (Instrumentation.java:1004)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at android.app.Application android.app.Instrumentation.newApplication(java.lang.ClassLoader, java.lang.String, android.content.Context) (Instrumentation.java:988)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at android.app.Application android.app.LoadedApk.makeApplication(boolean, android.app.Instrumentation) (LoadedApk.java:620)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5086)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void android.app.ActivityThread.access$1600(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:177)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1509)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void android.os.Looper.loop() (Looper.java:145)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5942)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[], boolean) (Method.java:-2)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:372)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1388)
07-08 17:57:21.060 23687-23687/com.legend.demo A/art: art/runtime/thread.cc:1116] at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1183)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #14 pc 000000e3 /system/framework/arm/boot.oat (Java_java_lang_reflect_ArtMethod_getNameNative__+82)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.ArtMethod.getNameNative!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.ArtMethod.getMethodName(ArtMethod.java:136)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.getName(Method.java:139)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.lody.legend.HookManager.applyHooks(HookManager.java:93)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.legend.demo.App.attachBaseContext(App.java:25)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke(Method.java:372)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:248)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.Application.attach(Application.java:205)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.Instrumentation.newApplication(Instrumentation.java:1004)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.Instrumentation.newApplication(Instrumentation.java:988)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.LoadedApk.makeApplication(LoadedApk.java:620)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5086)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.access$1600(ActivityThread.java:177)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Handler.dispatchMessage(Handler.java:102)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Looper.loop(Looper.java:145)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.main(ActivityThread.java:5942)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke(Method.java:372)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #14 pc 000000e3 /system/framework/arm/boot.oat (Java_java_lang_reflect_ArtMethod_getNameNative__+82)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.ArtMethod.getNameNative!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.ArtMethod.getMethodName(ArtMethod.java:136)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.getName(Method.java:139)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.lody.legend.HookManager.applyHooks(HookManager.java:93)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.legend.demo.App.attachBaseContext(App.java:25)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke(Method.java:372)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:248)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.Application.attach(Application.java:205)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.Instrumentation.newApplication(Instrumentation.java:1004)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.Instrumentation.newApplication(Instrumentation.java:988)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.LoadedApk.makeApplication(LoadedApk.java:620)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5086)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.access$1600(ActivityThread.java:177)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Handler.dispatchMessage(Handler.java:102)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.os.Looper.loop(Looper.java:145)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at android.app.ActivityThread.main(ActivityThread.java:5942)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.reflect.Method.invoke(Method.java:372)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 000003d3 /system/framework/arm/boot.oat (Java_java_lang_Object_wait__+82)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Object.wait!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - waiting on <0x3e3977a6> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:137)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - locked <0x3e3977a6> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Thread.run(Thread.java:818)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #7 pc 0005f391 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void_)+72)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 000005f7 /system/framework/arm/boot.oat (Java_java_lang_Object_wait__JI+102)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Object.wait!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - waiting on <0x3150b5e7> (a java.lang.ref.ReferenceQueue)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Object.wait(Object.java:422)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:101)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - locked <0x3150b5e7> (a java.lang.ref.ReferenceQueue)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:72)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:177)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Thread.run(Thread.java:818)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 000003d3 /system/framework/arm/boot.oat (Java_java_lang_Object_wait__+82)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Object.wait!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - waiting on <0x2e740594> (a java.lang.Daemons$FinalizerWatchdogDaemon)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Daemons$FinalizerWatchdogDaemon.waitForObject(Daemons.java:243)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - locked <0x2e740594> (a java.lang.Daemons$FinalizerWatchdogDaemon)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:215)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Thread.run(Thread.java:818)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #7 pc 0005f391 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void_)+72)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #5 pc 000003d3 /system/framework/arm/boot.oat (Java_java_lang_Object_wait__+82)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Object.wait!(Native method)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - waiting on <0x0591a83d> (a java.lang.Daemons$HeapTrimmerDaemon)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Daemons$HeapTrimmerDaemon.run(Daemons.java:314)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] - locked <0x0591a83d> (a java.lang.Daemons$HeapTrimmerDaemon)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Thread.run(Thread.java:818)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] native: #3 pc 000003d3 /system/framework/arm/boot.oat (Java_dalvik_system_VMRuntime_waitForConcurrentGCRequest__+82)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Daemons$GCDaemon.run(Daemons.java:334)
07-08 17:57:21.191 23687-23687/com.legend.demo A/art: art/runtime/runtime.cc:284] at java.lang.Thread.run(Thread.java:818)
07-08 17:57:21.281 297-297/? I/DEBUG: Abort message: 'art/runtime/thread.cc:1116] Throwing new exception 'length=643; index=51516434' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=77951; index=51516434'
07-08 17:57:21.901 917-23741/? W/ActivityManager: Exception thrown during pause
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:496)
at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:766)
at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:1199)
at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:3699)
at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:3513)
at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:3450)
at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:14836)
at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:14709)
at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:15475)
at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:14983)
at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
07-08 17:57:21.921 917-1033/? W/WindowManager: Failed looking up window
java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@21e4997c does not exist
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:10500)
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:10491)
at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:3319)
at com.android.server.wm.Session.remove(Session.java:194)
at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3236)
at android.view.ViewRootImpl.doDie(ViewRootImpl.java:6169)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3607)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)

demo hook 失败

给的测试用例hook失败,报错java.lang.NoSuchMethodError: No virtual method getSimSerialNumber()Ljava/lang/String; in class Landroid/telephony/TelephonyManager;

arm64位机没有对应的so

arm64位机没有对应的so,转而用32位so替换,用ndk编译jni目录生成的64位so,在实际hook时提示失败,请问是否有生成64位so的可能。

clear documentation

Hi asLoby, I am very much interested to evaluate legend Hook framework but I did find clear documentation to use in real cases.. can pull a clear documentation so that will help me to understand .

demo run crash!

I just run the demo in android 5.1 and 6.0 both are crashed.can the project work? it happend when hook the toast.show,hnnnnnnn,can you give me a way the fix that?

06-15 17:19:04.732 14798-14798/com.legend.demo I/art: Late-enabling -Xcheck:jni
06-15 17:19:04.852 14798-14798/com.legend.demo E/art: invalid stream - arg reg >= reg size (5 >= 5) in /data/data/com.legend.demo/files/instant-run/dex/slice-slice_1-classes.dex
06-15 17:19:04.852 14798-14798/com.legend.demo E/art: invalid stream - arg reg >= reg size (5 >= 5) in /data/data/com.legend.demo/files/instant-run/dex/slice-slice_1-classes.dex
06-15 17:19:04.853 14798-14798/com.legend.demo E/art: invalid stream - arg reg >= reg size (5 >= 5) in /data/data/com.legend.demo/files/instant-run/dex/slice-slice_1-classes.dex
06-15 17:19:04.887 14798-14798/com.legend.demo I/art: Verification error in void com.legend.demo.MainActivity$4.onClick(android.view.View)
06-15 17:19:04.887 14798-14798/com.legend.demo I/art: void com.legend.demo.MainActivity$4.onClick(android.view.View) failed to verify: void com.legend.demo.MainActivity$4.onClick(android.view.View): [0x1D] 'this' argument 'Reference: android.widget.Toast' not instance of 'Reference: com.legend.demo.App'
06-15 17:19:04.887 14798-14798/com.legend.demo E/art: Verification failed on class com.legend.demo.MainActivity$4 in /data/data/com.legend.demo/files/instant-run/dex/slice-slice_1-classes.dex because: Verifier rejected class com.legend.demo.MainActivity$4 due to bad method void com.legend.demo.MainActivity$4.onClick(android.view.View)
06-15 17:19:04.888 14798-14798/com.legend.demo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.legend.demo, PID: 14798
java.lang.VerifyError: Verifier rejected class com.legend.demo.MainActivity$4 due to bad method void com.legend.demo.MainActivity$4.onClick(android.view.View) (declaration of 'com.legend.demo.MainActivity$4' appears in /data/data/com.legend.demo/files/instant-run/dex/slice-slice_1-classes.dex)
at com.legend.demo.MainActivity.onCreate(MainActivity.java:61)
at android.app.Activity.performCreate(Activity.java:6107)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2594)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2710)
at android.app.ActivityThread.access$800(ActivityThread.java:179)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5803)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
06-15 17:19:04.944 14798-14798/com.legend.demo I/Process: Sending signal. PID: 14798 SIG: 9

Android 5.0.1

Error to Load Hook Method From : Activity_startActivity.
Error to Load Hook Method From : Application_onCreate.
Error to Load Hook Method From : TelephonyManager_getSimSerialNumber.
Error to Load Hook Method From : Toast_show.

hook不到TextView的setText

老铁求救啊 我hook了 TextView的setText方法 由于他会自动调用public的这个方法
public final void setText(CharSequence text) {
setText(text, mBufferType);
}
我hook这个方法
public void setText(CharSequence text, BufferType type) {
setText(text, type, true, 0);

if (mCharWrapper != null) {
    mCharWrapper.mChars = null;
}

}
但是没有作用 求教
@hook("android.widget.TextView::[email protected]#android.widget.TextView.BufferType")
public static void TextView_setText(TextView view, CharSequence text , TextView.BufferType type) {
Log.v(TAG,"this is text" );
HookManager.getDefault().callSuper(view,text,type);
}

对String.startsWith()做hook时会造成递归调用

如果hook了String.startsWith()方法, 在调用原方法callSuper时,会调用isArt();但isArt()里还会调用String.startsWith(),如此便造成无穷递归调用,应用无反应。

类似地,callSuper()中的某些调用如果被hook了并且hook方法中还有callSuper(),应该都会造成递归

demo crash when `show a toast` if switch to launcher an other app

test case:

  1. launcher legend demo app
  2. return to home & luacher an other app (eg: calcualtor)
  3. return to legend demo & click show a toast button

crash logcat:

--------- beginning of crash
04-02 16:56:27.181 18323 18323 F libc    : Fatal signal 11 (SIGSEGV), code 2, fault addr 0x12c0e084 in tid 18323 (com.legend.demo)
04-02 16:56:27.193   202   749 D audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
04-02 16:56:27.282   199   199 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-02 16:56:27.282   199   199 F DEBUG   : Build fingerprint: 'Android/aosp_hammerhead/hammerhead:6.0/MRA58K/potato03232147:userdebug/test-keys'
04-02 16:56:27.282   199   199 F DEBUG   : Revision: '0'
04-02 16:56:27.282   199   199 F DEBUG   : ABI: 'arm'
04-02 16:56:27.282   199   199 F DEBUG   : pid: 18323, tid: 18323, name: com.legend.demo  >>> com.legend.demo <<<
04-02 16:56:27.282   199   199 F DEBUG   : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x12c0e084
04-02 16:56:27.302   199   199 F DEBUG   :     r0 b5985000  r1 ffffffff  r2 00000001  r3 00000001
04-02 16:56:27.303   199   199 F DEBUG   :     r4 be8fd0ec  r5 b5985000  r6 be8fd124  r7 be8fd008
04-02 16:56:27.303   199   199 F DEBUG   :     r8 b6d31ec0  r9 be8fd120  sl 12c0e000  fp 00000000
04-02 16:56:27.303   199   199 F DEBUG   :     ip b4b3b085  sp be8fd000  lr b4b84db9  pc b4b84dc2  cpsr 00070030
04-02 16:56:27.311   199   199 F DEBUG   : 
04-02 16:56:27.311   199   199 F DEBUG   : backtrace:
04-02 16:56:27.311   199   199 F DEBUG   :     #00 pc 0032ddc2  /system/lib/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned int)+97)
04-02 16:56:27.311   199   199 F DEBUG   :     #01 pc 002e40a5  /system/lib/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobject*)+32)
04-02 16:56:27.311   199   199 F DEBUG   :     #02 pc 71ef0e39  /data/dalvik-cache/arm/system@[email protected] (offset 0x1eb5000)
04-02 16:56:27.693   199   199 F DEBUG   : 
04-02 16:56:27.693   199   199 F DEBUG   : Tombstone written to: /data/tombstones/tombstone_09
04-02 16:56:27.693   199   199 E DEBUG   : AM write failed: Broken pipe

android 7.0 is not support

09-17 14:11:56.843 6231-6231/com.dodola.rocoosample.runtimefix W/System.err: java.lang.SecurityException: Can not make a java.lang.reflect.Method constructor accessible
09-17 14:11:56.843 6231-6231/com.dodola.rocoosample.runtimefix W/System.err: at java.lang.reflect.AccessibleObject.setAccessible0(AccessibleObject.java:133)
09-17 14:11:56.844 6231-6231/com.dodola.rocoosample.runtimefix W/System.err: at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:89)
09-17 14:11:56.844 6231-6231/com.dodola.rocoosample.runtimefix W/System.err: at com.lody.legend.art.ArtMethod.backup(ArtMethod.java:109)
09-17 14:11:56.844 6231-6231/com.dodola.rocoosample.runtimefix W/System.err: at com.lody.legend.HookManager.hookMethodArt(HookManager.java:202)
09-17 14:11:56.844 6231-6231/com.dodola.rocoosample.runtimefix W/System.err: at com.lody.legend.HookManager.hookMethod(HookManager.java:137)

运行小米5sPlus就crash,android系统6.0.1

java.lang.VerifyError: Verifier rejected class com.legend.demo.MainActivity$4 due to bad method void com.legend.demo.MainActivity$4.onClick(android.view.View) (declaration of 'com.legend.demo.MainActivity$4' appears in /data/app/com.legend.demo-1/split_lib_slice_1_apk.apk)
at com.legend.demo.MainActivity.onCreate(MainActivity.java:60)
at android.app.Activity.performCreate(Activity.java:6323)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2518)
at android.app.ActivityThread.access$1000(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5544)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)

method hooked success, but it just does NOT work

`
@hook("org.apache.http.client.HttpClient::[email protected]")

  public static void HttpClient_execute(HttpUriRequest request)  {

    Log.d("XXXX", "HttpClient_execute method is " + request.getMethod());

    HookManager.getDefault().callSuper(request);

  }
`

Log显示execute被hook成功;执行以下代码:

`
       String url = "https://www.baidu.com/img/bd_logo1.png";

       HttpClient client = new DefaultHttpClient(getParams());

       HttpGet get = new HttpGet(url);

       try {

        HttpResponse httpResponse = client.execute(get);

       } catch (IOException e) {

        e.printStackTrace();

       }
`

执行后网络请求返回状态码200,但是没调用到hook函数

SDK不支持7.1

请问能处理下7.1的兼容性问题吗?7.1上面总报错,backup方法失败

miui运行例子,直接闪退 崩溃日志


Build fingerprint: 'Xiaomi/hermes/hermes:5.0.2/LRX22G/7.6.8:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 20575, tid: 20575, name: com.legend.demo >>> com.legend.demo <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x587889cb
r0 fffffa9c r1 8a819b54 r2 587889cb r3 f54d4a68
r4 5878896f r5 f7786dd4 r6 ffe39d78 r7 f7786dd4
r8 ab4a4d28 r9 f54d6ff4 sl 6ff60148 fp 6ff6cc70
ip 6f897894 sp ffe39d38 lr f53c42c1 pc f53c2564 cpsr 60070030

backtrace:
#00 pc 001e3564 /system/lib/libart.so

(_ZN3art6mirror5Class13GetDescriptorEPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+23)
#1 pc 001e52bd /system/lib/libart.so

(_ZN3art6mirror5Class18GetArrayDescriptorEPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+32)
#2 pc 001e3571 /system/lib/libart.so

(_ZN3art6mirror5Class13GetDescriptorEPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+36)
#3 pc 00241a2d /system/lib/libart.so

(_ZN3art16PrettyDescriptorEPNS_6mirror5ClassE+32)
#4 pc 0006a097 /system/lib/libart.so

(ZN3art24ThrowArrayStoreExceptionEPNS_6mirror5ClassES2+26)
#5 pc 000c0e45 /system/lib/libart.so

(ZN3art6mirror11ObjectArrayINS0_9ArtMethodEE15CheckAssignableILNS_17VerifyObjectFlagsE0EEEbPS2+56)
#6 pc 0024e287 /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier27ResolveMethodAndCheckAccessEjNS0_10MethodTypeE+970)
#7 pc 0024e421 /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier20VerifyInvocationArgsEPKNS_11InstructionENS0_10MethodTypeEbb+36)
#8 pc 0024f5b5 /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier25CodeFlowVerifyInstructionEPj+3224)
#9 pc 00251789 /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier20CodeFlowVerifyMethodEv+120)
#10 pc 00251bdf /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier14VerifyCodeFlowEv+582)
#11 pc 00251d47 /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier6VerifyEv+130)
#12 pc 002523d3 /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier12VerifyMethodEjPKNS_7DexFileENS_6HandleINS_6mirror8DexCacheEEENS5_INS6_11ClassLoaderEEEPKNS2_8ClassDefEPKNS2_8CodeItemEPNS6_9ArtMethodEjbb+106)
#13 pc 00252a1f /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier11VerifyClassEPKNS_7DexFileENS_6HandleINS_6mirror8DexCacheEEENS5_INS6_11ClassLoaderEEEPKNS2_8ClassDefEbPNSt3__112basic_stringIcNSE_11char_traitsIcEENSE_9allocatorIcEEEE+702)
#14 pc 00253061 /system/lib/libart.so

(_ZN3art8verifier14MethodVerifier11VerifyClassEPNS_6mirror5ClassEbPNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE+516)
#15 pc 000d55f1 /system/lib/libart.so

(_ZN3art11ClassLinker11VerifyClassENS_6HandleINS_6mirror5ClassEEE+576)
#16 pc 000d6c0f /system/lib/libart.so

(_ZN3art11ClassLinker15InitializeClassENS_6HandleINS_6mirror5ClassEEEbb+230)
#17 pc 000d77e7 /system/lib/libart.so

(_ZN3art11ClassLinker17EnsureInitializedENS_6HandleINS_6mirror5ClassEEEbb+54)
#18 pc 001fed3f /system/lib/libart.so

(_ZN3artL23Constructor_newInstanceEP7_JNIEnvP8_jobjectP13_jobjectArrayh+106)
#19 pc 0001ad33 /data/dalvik-cache/arm/system@[email protected]

Support for 64bit ABIs ?

The Application.mk explicitly lists only 32bits android ABIs.

Any reason for that?
As far as I can tell, the JNI code is trivial and portable

在Android 7.0上hook失败

12-05 12:10:26.005 13676-13676/? E/Legend-Log: [---] Error to Load Hook Method From : Application_onCreate.
12-05 12:10:26.005 13676-13676/? W/System.err: java.lang.IllegalStateException: Cannot create backup method from :: public void android.app.Application.onCreate()
12-05 12:10:26.005 13676-13676/? W/System.err: at com.lody.legend.art.ArtMethod.backup(ArtMethod.java:134)
12-05 12:10:26.005 13676-13676/? W/System.err: at com.lody.legend.HookManager.hookMethodArt(HookManager.java:199)
12-05 12:10:26.005 13676-13676/? W/System.err: at com.lody.legend.HookManager.hookMethod(HookManager.java:136)
12-05 12:10:26.005 13676-13676/? W/System.err: at com.lody.legend.HookManager.applyHooks(HookManager.java:91)
12-05 12:10:26.006 13676-13676/? W/System.err: at com.legend.demo.App.attachBaseContext(App.java:27)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.Application.attach(Application.java:189)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.Instrumentation.newApplication(Instrumentation.java:1008)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.Instrumentation.newApplication(Instrumentation.java:992)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5335)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.ActivityThread.-wrap2(ActivityThread.java)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.os.Looper.loop(Looper.java:154)
12-05 12:10:26.006 13676-13676/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6077)
12-05 12:10:26.006 13676-13676/? W/System.err: at java.lang.reflect.Method.invoke(Native Method)
12-05 12:10:26.006 13676-13676/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
12-05 12:10:26.006 13676-13676/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

5.1奔溃了 手机虚拟机都有

11-16 17:09:47.787 1003-1003/com.ct.plat.android.ZhiFuSecurity A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x20 in tid 1003 (d.ZhiFuSecurity)
11-16 17:09:47.902 79-79/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-16 17:09:47.902 79-79/? I/DEBUG: Build fingerprint: 'Meizu/Meizu/PRO 6 Plus:5.1.1/KTU84P/eng.se.infra.20170110.154925:userdebug/release-keys'
11-16 17:09:47.902 79-79/? I/DEBUG: Revision: '0'
11-16 17:09:47.902 79-79/? I/DEBUG: ABI: 'x86'
11-16 17:09:47.902 79-79/? I/DEBUG: pid: 1003, tid: 1003, name: d.ZhiFuSecurity >>> com.ct.plat.android.ZhiFuSecurity <<<
11-16 17:09:47.902 79-79/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
11-16 17:09:47.965 79-79/? I/DEBUG: eax 00000000 ebx b3bfcaa4 ecx 6fae6d3c edx 0000ed64
11-16 17:09:47.966 79-79/? I/DEBUG: esi 6fae6d20 edi 6fae6d20
11-16 17:09:47.966 79-79/? I/DEBUG: xcs 00000073 xds 0000007b xes 0000007b xfs 00000007 xss 0000007b
11-16 17:09:47.966 79-79/? I/DEBUG: eip b3a03c4e ebp bff30968 esp bff30920 flags 00210246
11-16 17:09:47.966 79-79/? I/DEBUG: backtrace:
11-16 17:09:47.966 79-79/? I/DEBUG: #00 pc 00316c4e /system/lib/libart.so (art::mirror::Class::FindDeclaredVirtualMethod(art::StringPiece const&, art::Signature const&)+142)
11-16 17:09:47.966 79-79/? I/DEBUG: #1 pc 00316f3e /system/lib/libart.so (art::mirror::Class::FindVirtualMethod(art::StringPiece const&, art::Signature const&)+46)
11-16 17:09:47.966 79-79/? I/DEBUG: #2 pc 003d9c4d /system/lib/libart.so (art::verifier::MethodVerifier::ResolveMethodAndCheckAccess(unsigned int, art::verifier::MethodType)+397)
11-16 17:09:47.966 79-79/? I/DEBUG: #3 pc 003da40e /system/lib/libart.so (art::verifier::MethodVerifier::VerifyInvocationArgs(art::Instruction const*, art::verifier::MethodType, bool, bool)+94)
11-16 17:09:47.966 79-79/? I/DEBUG: #4 pc 003dcbf1 /system/lib/libart.so (art::verifier::MethodVerifier::CodeFlowVerifyInstruction(unsigned int*)+6289)
11-16 17:09:47.966 79-79/? I/DEBUG: #5 pc 003e0567 /system/lib/libart.so (art::verifier::MethodVerifier::CodeFlowVerifyMethod()+151)
11-16 17:09:47.966 79-79/? I/DEBUG: #6 pc 003e0ada /system/lib/libart.so (art::verifier::MethodVerifier::VerifyCodeFlow()+970)
11-16 17:09:47.966 79-79/? I/DEBUG: #7 pc 003e0d0f /system/lib/libart.so (art::verifier::MethodVerifier::Verify()+191)
11-16 17:09:47.966 79-79/? I/DEBUG: #8 pc 003e144e /system/lib/libart.so (art::verifier::MethodVerifier::VerifyMethod(unsigned int, art::DexFile const*, art::Handleart::mirror::DexCache, art::Handleart::mirror::ClassLoader, art::DexFile::ClassDef const*, art::DexFile::CodeItem const*, art::mirror::ArtMethod*, unsigned int, bool, bool)+270)
11-16 17:09:47.966 79-79/? I/DEBUG: #9 pc 003e1e72 /system/lib/libart.so (art::verifier::MethodVerifier::VerifyClass(art::DexFile const*, art::Handleart::mirror::DexCache, art::Handleart::mirror::ClassLoader, art::DexFile::ClassDef const*, bool, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)+1058)
11-16 17:09:47.966 79-79/? I/DEBUG: #10 pc 003e2748 /system/lib/libart.so (art::verifier::MethodVerifier::VerifyClass(art::mirror::Class
, bool, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >*)+328)
11-16 17:09:47.966 79-79/? I/DEBUG: #11 pc 00147927 /system/lib/libart.so (art::ClassLinker::VerifyClass(art::Handleart::mirror::Class)+1159)
11-16 17:09:47.966 79-79/? I/DEBUG: #12 pc 001499b6 /system/lib/libart.so (art::ClassLinker::InitializeClass(art::Handleart::mirror::Class, bool, bool)+294)
11-16 17:09:47.966 79-79/? I/DEBUG: #13 pc 0014ac4c /system/lib/libart.so (art::ClassLinker::EnsureInitialized(art::Handleart::mirror::Class, bool, bool)+108)
11-16 17:09:47.966 79-79/? I/DEBUG: #14 pc 003460df /system/lib/libart.so
11-16 17:09:47.966 79-79/? I/DEBUG: #15 pc 00021eab /data/dalvik-cache/x86/system@[email protected]

                                [ 11-16 17:09:48.043   265:  966 D/         ]
                                HostConnection::get() New Host Connection established 0xb602d2e0, tid 966

11-16 17:09:48.115 79-79/? I/DEBUG: Tombstone written to: /data/tombstones/tombstone_07

如何hook自定义类的构造方法,在调用callSuper时候参数没法设定

E/Legend-Log: [---] Call super method with error : expected receiver of type com.baidu.mobads.g.b, but got java.io.File, detail message please see the [Logcat :system.err].
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: java.lang.IllegalArgumentException: expected receiver of type com.baidu.mobads.g.b, but got java.io.File
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.lody.legend.HookManager.callSuperDalvik(HookManager.java:335)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.lody.legend.HookManager.callSuper(HookManager.java:282)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.b.b(SourceFile:240)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.b.b(SourceFile:99)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.g.b(SourceFile:370)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.g.c(SourceFile:393)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.g.d(SourceFile:292)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.g.f(SourceFile:592)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.g.b(SourceFile:663)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.g.a(SourceFile:44)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at com.baidu.mobads.g.n.run(SourceFile:689)
05-16 11:53:30.767 32709-32740/com.legend.demo W/System.err: at java.lang.Thread.run(Thread.java:841)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.