Skip to content

Instantly share code, notes, and snippets.

@ManiaciaChao
Created May 21, 2025 09:50
Show Gist options
  • Save ManiaciaChao/2aac123c0336dcd3c0c8e50e291ccdcd to your computer and use it in GitHub Desktop.
Save ManiaciaChao/2aac123c0336dcd3c0c8e50e291ccdcd to your computer and use it in GitHub Desktop.
fish command that leverage 3rd-party installer instead of adb
function adb-install
if test (count $argv) -ne 1
echo "Usage: adb-install <path-to-apk>"
return 1
end
set apk_path $argv[1]
set random_name (random 100000 999999)
set temp_path "/data/local/tmp/temp_install_$random_name.apk"
echo "Pushing APK to device..."
# Push the APK to the device
if not adb push $apk_path $temp_path
echo "Failed to push APK to device"
return 1
end
echo "Invoking installer..."
# Launch the package installer
adb shell am start -a android.intent.action.VIEW \
-d file://$temp_path \
-t application/vnd.android.package-archive
read -l -P "Press Enter when done to remove tmp file..." confirm
# Clean up the temporary file
adb shell rm $temp_path
echo "Temporary file removed."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment