备份和还原所有安装的apk

 

  • 找出设备上安装的第三方apk包名: adb shell pm list packages -3
  • 依据apk包名找出apk: adb shell pm path $pkg
  • 导出apk文件: adb shell pull $path
  • 把导出的apk文件安装到新设备里: adb install -r $file

脚本:

#!/bin/shecho -n "" > apksadb shell pm list packages -3 | sed -E "s/ $//" | while read linedo pkg=${line#*:} line=$(adb shell pm path "$pkg"&) path=${line#*:} echo $pkg:$path >> apksdonecat apkscat apks | sed -E "s/ $//" | while read linedo pkg=${line%:*} path=${line#*:} adb pull "$path" "$pkg.apk" echo $pathdonerm apks#echo $apks;