Skip to content

Is registerClass broken | not working? #73

@snooze6

Description

@snooze6

I was trying to use registerClass function while I realized that it was not working on my actual setup. The code is the following:

Java.perform(function(){
	console.log('Android version:  '+Java.androidVersion);
	console.log('Frida version:    '+Frida.version);
	console.log('Process arch:     '+Process.arch);
	console.log('Process Platform: '+Process.platform);
	var System = Java.use("java.lang.System");
	console.log('Java vm version:  '+System.getProperty("java.vm.version"));
	
	console.log('Trying to register new class...');
	try {
        var Runnable = Java.use('java.lang.Runnable');
        var MyRunnable = Java.registerClass({
            name: 'com.example.MyRunnable',
            implements: [Runnable],
            methods: {
                'run': function() {
                    console.log('Hello!!!');
                }
            }
        });
        // var runnable = MyRunnable.$new();
        // runnable.run();

    } catch (e) {
        console.log("[!] - registerClass error");
		console.log(e);
    }
});

The expected result would be no exceptions everything running fine, but the actual output is

Android version:  8.0.0
Frida version:    11.0.2
Process arch:     arm64
Process Platform: linux
Java vm version:  2.1.0
Trying to register new class...
[!] - registerClass error
Error: java.lang.ClassNotFoundException: Didn't find class "MyRunnable" on path: DexPathList[[zip file "/data/data/com.google.android.deskclock/cache/raw1314848924905500505dex"],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]
undefined

I´m using an LG Nexus 5 running Android 8.0.0 (64 bit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions