javahookfrida

create 'java.util.List' Frida


i create frida java.util.List

argument types : 'java.lang.String', 'java.util.List'

no accept error argument types do not match any of:

private List x = new ArrayList();

public String get_content(String str, List list)

my javascript code

hook.get_content("asdasd",[]);

i have another question

when I run the function from the library under a library I get this error

cannot call instance method without an instance


Solution

  • Frida doesn't cast Javascript array [] to java.util.List.

    Solution:

    hook.get_content("asdasd", Java.use('java.util.ArrayList').$new());
    

    An example of list with items

    var ArrayList = Java.use('java.util.ArrayList');
    var items = ArrayList.$new();
    items.add('a string');
    hook.get_content("asdasd", arr);
    

    For your second question

    cannot call instance method without an instance

    take a look here

    Update:

    hook.get_content("asdasd", Java.use('java.util.ArrayList').$new(), true, 1);