Last updated: September 29, 2023

Getting Loaded Classes and Methods Dynamically

You can use the command Java in the Frida CLI to access the Java runtime and retrieve information from the running app. Remember that, unlike Frida for iOS, in Android you need to wrap your code inside a Java.perform function. Thus, it's more convenient to use Frida scripts to e.g. get a list of loaded Java classes and their corresponding methods and fields or for more complex information gathering or instrumentation. One such scripts is listed below. The script to list class's methods used below is available on Github.

// Get list of loaded Java classes and methods

// Filename: java_class_listing.js

Java.perform(function() {
        onMatch: function(className) {
        onComplete: function() {}

// Get the methods and fields
function describeJavaClass(className) {
  var jClass = Java.use(className);
    _name: className,
    _methods: Object.getOwnPropertyNames(jClass.__proto__).filter(function(m) {
      return !m.startsWith('$') // filter out Frida related special properties
        || m == 'class' || m == 'constructor' // optional
    _fields: jClass.class.getFields().map(function(f) {
      return( f.toString());
  }, null, 2));

After saving the script to a file called java_class_listing.js, you can tell Frida CLI to load it by using the flag -l and inject it to the process ID specified by -p.

frida -U -l java_class_listing.js -p <pid>

// Output
[Huawei Nexus 6P::sg.vantagepoint.helloworldjni]->

  "_name": "com.scottyab.rootbeer.sample.MainActivity",
  "_methods": [
  "_fields": [
    "public static final int",

Given the verbosity of the output, the system classes can be filtered out programmatically to make output more readable and relevant to the use case.