Is there some tool that can be used in ADB shell or something similar (without root possibly) that can invoke a function in the app, while it is running?

1 Answer 1


Rooted device

On rooted devices private function in apps can be called quite easily (in most cases) using a tool like Frida. Frida is like a mixture of a "scriptable debugger" and Xposed framework with the difference that you don't have to deal with low-level code like regular debuggers and the disadvantage of Xposed that when changing your scripting code you don't have to reboot the whole phone.

Frida allows to write JavaScript code that is executed within the app and you also have an interactive shell for finding or creating class instances, calling functions and so on. Frida is like a Swiss-Army-Knife for reverse-engineering and third party app debugging.

Unrooted device

On an unrooted device and an app that is a regular release app (not a debug build) you can't invoke a function within the app without modifying the app. For example you could try to decompile the app using apktool, modify the Smali code to execute the function e.g. if a certain UI button is pressed and recompile and resign the app with a new certificate. But be aware that Smali is a very low-level language - so even if you are familiar with Java and Android development modifying Smali code will be challenging

  • If you resign an app, it won't install without fully removing the app, including the app files. Or is there some way to keep them, for I would like to preserve these files. Commented Jun 10, 2022 at 11:03
  • @hiddenhospitalresearch That is correct, you have to delete app data. If you install the app via adb you can use adb install -r <abc.apk> which will delete app data. If the app allows backup via adb you can try to backup the app data using adb backup <packagename> (check .ab file size afterwards success = file size is larger than 1KB) and after replacing the app restore the backup data.
    – Robert
    Commented Jun 10, 2022 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .