Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException: Didn't find class #258

Open
USTCerirl opened this issue Jun 13, 2023 · 1 comment
Open

ClassNotFoundException: Didn't find class #258

USTCerirl opened this issue Jun 13, 2023 · 1 comment

Comments

@USTCerirl
Copy link

Hi there, I m new to frida and I wanna try my first frida hook to log out "Hello Frida!", but every method I wanna hook will throw this exception, I have no idea wut to do rn. can anyone help me? I d appreciate it!

This is the frida frag I copy from jadx:
let StartActivity = Java.use("com.e4a.runtime.android.StartActivity");
StartActivity["onCreate"].implementation = function (bundle) {
console.log(StartActivity.onCreate is called: bundle=${bundle});
console.log('Hello Frida');
this"onCreate";
};

This is the command I type in cmd: frida -U -l hello.js -f com.example.lof (cuz I try to hook a oncreate method, so I try to start it in spawn mode.)

This is the result I get:
Error: java.lang.ClassNotFoundException: Didn't find class "com.e4a.runtime.android.StartActivity" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib64, /system/vendor/lib64, /system/lib64, /system/vendor/lib64]]
at (frida/node_modules/frida-java-bridge/lib/env.js:124)
at (frida/node_modules/frida-java-bridge/lib/env.js:115)
at apply (native)
at (frida/node_modules/frida-java-bridge/lib/env.js:97)
at (frida/node_modules/frida-java-bridge/lib/class-factory.js:488)
at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:945)
at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:950)
at _make (frida/node_modules/frida-java-bridge/lib/class-factory.js:165)
at use (frida/node_modules/frida-java-bridge/lib/class-factory.js:62)
at use (frida/node_modules/frida-java-bridge/index.js:258)
at main (D:\Desktop\frida_demo\hello.js:2)
at apply (native)
at (frida/runtime/core.js:51)

@1trackprojects1
Copy link

1trackprojects1 commented Jun 21, 2024

I'm getting the same issue, anyone else?

Update: FIXED IT!!! - basically just wrap your code around with another function like this:

Java.perform(function () {
    // code here
});

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

No branches or pull requests

2 participants