Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

416
Views
Constructing a string array with Frida

I'm trying to call a function with Frida that takes a string array as one of its arguments.

public void coolFunction(long value, String[] strArr);

Within Java it gets called like this:

long importantValue = 4L;
String[] importantArr = new String[]{"TEST"};
coolFunction(importantValue, importantArr);

The overload looks like this: .overload('long', '[Ljava.lang.String;')

I could probably create a string array from scratch, but I don't know how to express it in Javascript. What's the Frida equivalent of new String[]{"TEST"}?

Because of that I tried to turn an ArrayList<String> into a String[], which also wasn't successful.

As far as I can tell there are two simple ways to turn ArrayList<String> into String[]:

Attempt #1:

List<String> list = new ArrayList<String>();
list.add("TEST");
String[] stringArray = list.toArray(new String[0]);

If I try to express it with Javascript it looks like this:

var AL_class = Java.use("java.util.ArrayList");
var arrList = AL_class.$new();
arrList.add("TEST");
var stringArray = arrList.toArray(Java.use("[Ljava.lang.String;").$new(0));

This fails with the following error message:

Error: no supported overloads

Attempt #2:

List<String> list = new ArrayList<String>();
list.add("TEST");
Object[] objectArray = list.toArray();
String[] stringArray = (String[]) objectArray;

Javascript:

var AL_class = Java.use("java.util.ArrayList");
var arrList = AL_class.$new();
arrList.add("TEST");
var arrayButAsObject = arrList.toArray();
var stringArray = Java.cast(arrayButAsObject, "[Ljava.lang.String;");

This fails because it assumes that I want to use Javascript's toArray() function.

The solution to this problem is probably very simple but I've been stuck here for quite a while now and can't seem to figure it out. Any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Instead of trying to use construct a List and then convert it to an array I would use the Frida function Java.array and directly construct a String array:

var javaStringArray = Java.array('java.lang.String', [ "Test" ]);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!