Shizuku

by Casey Ng

Version 2 (July 31, 2023)

Download (144 downloads)

Usual operation: Start "Watchdogs"

When needed: Start "Start Shizuku server"

To run commands: use a flow start block in your flow and call the "Run command" block and pass the command via the payload.

Helpers:
"Command dialog" for running adb commands.
"Common commands" for a set of useful operations.

-------------------------

Things to set up:

1. Install automate settings permission from here https://play.google.com/store/apps/details?id=com.llamalab.automate.ext.settings if it's not already installed.

2a. Setup shizuku using "Start via Wireless debugging".
2b. Then export the files in Shizuku through the "Use Shizuku in terminal apps" to sdcard/Shizuku folder.

3. Setup block #28 ADB shell command by installing and pairing the phone over Wi-Fi.

4. Save the following lines into "rish-automate" in sdcard/Shizuku folder.

###begin of script###

#!/system/bin/sh
BASEDIR=$(dirname "$0")
DEX="$BASEDIR"/rish_shizuku.dex

if [ ! -f "$DEX" ]; then
echo "Cannot find $DEX, please check the tutorial in Shizuku app"
exit 1
fi

# Replace "PKG" with the application id of your terminal app
[ -z "$RISH_APPLICATION_ID" ] && export RISH_APPLICATION_ID="com.llamalab.automate"
/system/bin/app_process -Djava.class.path="$DEX" /system/bin --nice-name=rish rikka.shizuku.shell.ShizukuShellLoader "$@"


###end of script###

5. Grant automate WRITE_SECURE_SETTINGS permission the "command dialog" block or via adb on usb. This only needs to be done once. 

"pm grant com.llamalab.automate android.permission.WRITE_SECURE_SETTINGS"

6. Then start "Watchdogs" and shizuku should run as each time the phone restarts.

-------------------------

Troubleshooting
Q1. Shizuku doesn't start after rebooting.
A1. Run "Start Shizuku server" then toggle the Wi-Fi connection from off to on. You can leave Wi-Fi in whatever state after Shizuku starts.

Q2. Start Shizuku server fails with "javax.net.ssl.SSLProtocolException"
A2. Re-pair the adb shell command block. This usually happens when the pairing is lost.

Q3. I don't know how to pair Shizuku/ADB.
A3. You got to read the instructions from the relevant parts. I won't replicate the steps here cuz they are very lengthy.

Q4. The flow is more than 30 blocks, or I don't have premium.
A4. You can either reduce the block counts, but I suggest you pay for premium. It's not expensive anyway.