有些Class里面有Handler对象,就必须在 主线程里执行,否则报错
E/AndroidRuntime( 2434): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 2434): at dalvik.system.NativeStart.run(Native Method)
E/AndroidRuntime( 2434): Caused by: java.lang.RuntimeException: Can’t create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 2434): at android.os.Handler.(Handler.java:200)
Frida提供了这样的设施, 那就是 scheduleOnMainThread
send(Java.available);
Java.perform(function () {
send(Java.androidVersion);
send(Java.isMainThread());
Java.scheduleOnMainThread(function () {
send(Java.isMainThread());
var Mgr = Java.use("me.app.im.Mgr");
var MgrInstance = Mgr.a();
var Region = MgrInstance.v();
send(Region);
});
});