Android App Data save and restore


저장 경로

/data/data/<package_name>

  • databases/: here go the app's databases
  • lib/: libraries and helpers for the app
  • files/: other related files
  • shared_prefs/: preferences and settings
  • cache/: well, caches

저장 위치까지 모두 출력

  • adb shell pm list packages -f

backup 명령어

## backup nonsystem apk
adb backup -apk -shared -nosystem -all -f backup_apk.ab

### backup system and nonsystem apk
adb backup -apk -noshared -system -all -f backup_apk.ab

## backup individual apk
adb backup -apk com.example.testing -f testing.ab

## restore all
adb restore backup_apk.ab
  • apk – Backs up your apps.
  • noapk – Does not backup apps.
  • shared – Backs up data on the SD card.
  • noshared – Does not backup data on the SD card.

백업파일 tar로 변환하는 방법

Command 스타일

dd if=myAndroidBackup.ab bs=4K iflag=skip_bytes skip=24 | openssl zlib -d > myAndroidBackup.tar

dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf

참고

정리잘된 블로그

AOSP 코드에 기반한 방법

깃허브 주소
https://github.com/nelenkov/android-backup-extractor

참고사이트

https://www.linkedin.com/pulse/backup-restore-your-android-phone-using-adb-ajibola-okubanjo/


+ Recent posts