frida-python
frida-python copied to clipboard
Hooking mainAcitvity doesn't work on some apps
I used the following js code to create a new instance of MainActivity
setTimeout(function () { Java.perform(function () { var myClass = Java.use("com.example.app.MainActivity"); var myInstance = myClass.$new(); send("here"); var res = myInstance.func("Parameter"); send("result ==> "+res); }); }, 0);
Which apparently gave me the following error
{u'columnNumber': 1, u'description': u"Error: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()", u'fileName': u'frida/node_modules/frida-java/lib/env.js', u'lineNumber': 222, u'type': u'error', u'stack': u"Error: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()\n at frida/node_modules/frida-java/lib/env.js:222\n at MainActivity (input:1)\n at apply (native)\n at r (frida/node_modules/frida-java/lib/class-factory.js:940)\n at [anon] (script1.js:5)\n at frida/node_modules/frida-java/lib/vm.js:39\n at y (frida/node_modules/frida-java/index.js:325)\n at frida/node_modules/frida-java/index.js:297\n at frida/node_modules/frida-java/lib/vm.js:39\n at java.js:2208\n [...]"}
I don't understand why this is not working, it should be able to do it, shouldn't it?
I met the same issue, hope solutions