Search code examples
androidandroid-emulatoradbandroid-virtual-device

How to export and import Android emulator snapshot


I didn't find any documentation on how to use these 2 guys
adb emu avd snapshot pull
adb emu avd snapshot push

I am able to export an existing AVD snapshot with

$ adb emu avd snapshot pull baseline /User/user1/baseline  

WARNING: unrecognized file format /User/user1/baseline
OK

It seems that I am also able to import the AVD snapshot with

$ adb emu avd snapshot push baseline /Users/user1/baseline

WARNING: unrecognized file format /Users/user1/baseline
OK

Listing the snapshots with adb emu avd snapshot list shows nothing. What is the correct way to export and import AVD snapshots?


Solution

  • Answering my own question

    While running snapshot list after snapshot push doesn't show the pushed snapshot, running snapshot load baseline actually loads the pushed snapshot and everything works as expected.

    My course of action

    Export the snapshot

    1. adb emu avd snapshot save baseline
    2. adb emu avd snapshot pull baseline /Users/user1/baseline

    Import the snapshot

    1. Start the emulator (in my case with -wipe-data)
    2. adb emu avd snapshot push baseline /Users/user1/baseline
    3. adb emu avd snapshot load baseline