Magiskis a suite of open source software for customizing Android devices. It provides users the ability to execute system commands on production devices and even extend features through modules. Magisk also provides a neat feature called MagiskHide, which hides certain root artifacts from detection methods used by apps.
When MagiskHide is enabled, it is not possible to spawn or launch a process using Frida (with the -f option). You will get the following error when you try to run frida -U -l hook.js -f
com.example.app --no-pause:
The obvious one is to temporarily disable MagiskHide. You can quickly disable it through the command-line using adb. Run adb shell "su -c magiskhide disable" (note: using su -c because adb shell root does not work on production builds).
Another way is to create a script to automatically start an app using built-in Android utilities, then quickly attach to that process with Frida. This method is not fool proof but does provide decent results. You can use utilities like adb shell am start or adb shell monkey to spawn a process.
3a8082e126