0

I'm a beginner with Frida. When I first started using Frida, I encountered an error.

Android version: 11 frida-server version: 17.0.7

└─$ pip list | grep frida
frida                          17.0.7
frida-tools                    14.0.2

The js files used are as follows:

console.log("frida agent started");
try {
  console.log("Process.arch = " + Process.arch);
} catch (e) {
  console.log("Process.arch unknown: " + e);
}
console.log("typeof Java = " + typeof Java);

setImmediate(function () {
  try {
    if (typeof Java !== "undefined" && Java.available) {
      console.log("Java.available = true");
      Java.perform(function () {
        try {
          console.log(
            "Java.perform OK. Runtime: " + Java.vm.getEnv().getClass()
          );
        } catch (e) {
          console.log("Java.perform inner error: " + e);
        }
      });
    } else {
      console.log(
        "Java.available = false (no Java VM exposed to this process)"
      );
    }
  } catch (e) {
    console.log("probe setImmediate error: " + e);
  }
});

Display information:

. . . .   Connected to 192.138.101.160:27042 ([email protected]:27042)
Attaching...                                          
frida agent started
Process.arch = arm                                    typeof Java = object                                  Java.available = true
probe setImmediate error: TypeError: cannot set property '_code' of null                                    Error: invalid instruction                                at value (/frida/runtime/core.js:457)                 at arm (/frida/bridges/java.js:1)                     at <anonymous> (/frida/bridges/java.js:1)             at _patchCode (native)                                at value (/frida/runtime/core.js:183)                 at Ot (/frida/bridges/java.js:1)                      at <anonymous> (/frida/bridges/java.js:1)             at <anonymous> (/frida/bridges/java.js:1)             at Ye (/frida/bridges/java.js:1)                      at <anonymous> (/frida/bridges/java.js:1)             at build (/frida/bridges/java.js:1)                   at _make (/frida/bridges/java.js:8)                   at use (/frida/bridges/java.js:8)                     at <anonymous> (/frida/bridges/java.js:8)             at <anonymous> (/frida/bridges/java.js:1)
    at _performPendingVmOpsWhenReady (/frida/bridges/java.js:8)
    at perform (/frida/bridges/java.js:8)
    at <anonymous> (/root/frida/hello.js:20)              at apply (native)
    at <anonymous> (/frida/runtime/core.js:55)

Regarding the version correspondence aspect, I have made the corresponding arrangements according to the following GitHub repository.

https://github.com/thelicato/frida-compatibility-matrix

How should I solve this error?

4
  • Your Android version is pretty old. It often happens that newer Frida versions do not work well with older Android versions because of patches for newer Android versions. I would try an older Frida version. Note that with Frida 17.0 some breaking changes were introduced. Therefore for using older Frida versions it might be require to make some minor changes to your code. Commented Nov 10 at 8:06
  • @Robert I once tried version 14.2.18, but this error still occurred. I don't know how to match it with the Android version. Is there a table for the correspondence? Commented Nov 11 at 2:50
  • Is there a special need why you use code in setImmediate instead of directly writing it into the script? Commented Nov 11 at 8:48
  • @Robert There was no specific reason. The above code was merely something I copied and pasted to verify since I suspected that the error was due to a problem with my code. Additionally, the purpose of using Frida was simply to view the callback code triggered when a button is pressed. Commented Nov 11 at 11:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.