Skip to content

(fix) use generic API selector instead of Android API#383

Closed
leonjza wants to merge 1 commit intofrida:mainfrom
leonjza:main
Closed

(fix) use generic API selector instead of Android API#383
leonjza wants to merge 1 commit intofrida:mainfrom
leonjza:main

Conversation

@leonjza
Copy link
Contributor

@leonjza leonjza commented Mar 14, 2026

Before this patch, using HotSpot would fail inside of Java.perform() with errors like:

TypeError: cannot convert to object
    at compileModule (node_modules/frida-java-bridge/lib/class-model.js:1324)
    at ensureInitialized (node_modules/frida-java-bridge/lib/class-model.js:1317)
    at build (node_modules/frida-java-bridge/lib/class-model.js:1227)
    at _make (node_modules/frida-java-bridge/lib/class-factory.js:287)
    at use (node_modules/frida-java-bridge/lib/class-factory.js:158)
    at enumerateMethods (node_modules/frida-java-bridge/index.js:312)
    at <anonymous> (agent/index.ts:9)
    at <anonymous> (node_modules/frida-java-bridge/lib/vm.js:35)
    at perform (node_modules/frida-java-bridge/index.js:370)
    at <anonymous> (agent/index.ts:9)

On a JVM target, android.getApi() returns null, so the first Java.* call that builds a class model fails tries to destruct jvmti from that null API object. This change switches class-model.js to import getApi() from lib/api.js instead of via lib/android.js, which is already the bridge's backend selector.

  • On Android, lib/api.js continues to use android.getApi()
  • On JVM, it falls back to jvm.getApi()

@leonjza
Copy link
Contributor Author

leonjza commented Mar 14, 2026

Ah, saw too late, this is a dupe of #382 .

@leonjza leonjza closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant