Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Possible Duplicate:
Android Market gone after emulator reboot

I am having the same problem as mentioned here. But my specs are as follows:

OS=Windows 7 SP1 SDK Revision = 21.0.1

  • OS = Windows 7 SP1
  • SDK Revision = 21.0.1
  • Android-SDK=3.0(API Level 11)

AVD Details

Name: DemoDevice1

CPU/ABI: ARM(armeabi)

Path: c:\Users\The WABBIT.android\AVD\DemoDevice1.avd

Target: Android 3.0 (API level 11)

Skin: WXGA

SD Card: 2048

hw.lcd.density: 213

vm.heapSize: 32

hw.ramSize: 1024

I have already deleted the SdkSetup.apk from the emulator and then added the GoogleServicesFramework.apk and Vending.apk packages to the emulator.

But, upon reboot everything is reverted back to before changes was made. I am unable to find a updated img file in any temporary directory, or any directory, as outlined in above mentioned post.

Can anyone help me with this?

share|improve this question

marked as duplicate by Ryan Conrad, Liam W, Lie Ryan, ce4, roxan Jan 6 '13 at 14:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
the /tmp/ directory that is mention, AFAIK, is on the "PC" (linux in this case), not on the file system of the emulator. –  Ryan Conrad Jan 6 '13 at 5:44
    
Ryan, I totally understood that the answer given in Android Market gone after emulator reboot was more than likely what I needed. But the location of the temp .img directory and the name of the .img was not found on my Windows 7 PC. What was given there was more than likely for Linux only, or for that specific revision of SDK. –  user26223 Jan 6 '13 at 8:02
    
Anyways I found the temp .img directory and the .img file. Again, it does not match anything from the answer in Android Market gone after emulator reboot. The answer will follow. –  user26223 Jan 6 '13 at 8:05
    
now that you have found it on windows, I suggest you post your answer in the original question. –  Ryan Conrad Jan 6 '13 at 14:48

1 Answer 1

For those that are using the Windows version of the Android SDK the answer given in Android Market gone after emulator reboot stands as the correct thing to do. But the name of the .img file and the temp directory location differ from that given in that post.

The reason for the difference I cannot say, but I suspect it is because of one of the following reasons.

  1. I am using Windows instead of Linux.
  2. I am using a different revision of the SDK, can't really say as there was no mention of the SDK revision in the previous post.
  3. Or it could be both 1 & 2.

Any ways, you will find the temp .img directory in the following location:

SystemDrive\Users\ [username] \AppData\Local\Temp\AndroidEmulator

The file name will be similar to the following:

TMP19AD.tmp

Note: - The file name will change every time you run the emulator. - That the file size will always be 0bytes will the emulator is running. - It is easier to work on one virtual device at a time when accessing the temp .img files. Otherwise it gets confusing which file is for which virtual device.

To make your changes permanent do the following:

  1. Work on one virtual device at a time.
  2. Copy the .tmp from the AndroidEmulator directory to a temporary location before exiting the emulator.
  3. Rename the *.tmp file to system.img.
  4. Copy the system.img file to your virtual device's AVD directory. Overwriting any previous system.img file.

I have created the following batch file to do the copying.

system_copy.bat

@echo off
rem
rem system_copy.bat
rem
rem Command-line reference:
rem     system_copy [drive_letter] [account_username] [virtual_device's_name]
rem

rem
rem check to see if the user entered the parameters needed
rem
rem check for the drive letter
if [%1] == [] goto :error1
rem check for the account username
if [%2] == [] goto error2
rem check for the virtual device's name
if [%3] == [] goto error3

rem
rem set the paths for the tmp_path and main_avd_path
rem to use in the copying process
rem
:SetPaths
rem Grab current directory before we change it
rem this will be directory outside of the virtual device's directory
set main_avd_path="%cd%"

rem set the current location for the temp AVD .img files
set tmp_path=%1:\Users\%2\AppData\Local\Temp\AndroidEmulator

rem now we need to verify a few things

rem verify that the temp_path exist
if not exist %tmp_path% goto error4
rem verify that the temporary .img file exist
if not exist %tmp_path%\*.tmp goto error5

rem now we begin the copying of the system.img file
echo.
echo Copying the *.tmp file to the virtual device's avd directory as system.img.
echo.

copy %tmp_path%\*.tmp %main_avd_path%\%3%.avd\system.img /y >nul

rem check for any errors in copying the file
for %%e in (5 4 3 2 1) do if errorlevel %%e goto copyerror-%%e

if not errorlevel == 0 goto copyerror-0

rem show copy succes message
echo.
echo Copying is complete.
echo.
goto :EOF

rem beginning of the error messages
:error1
    echo.
    echo ERROR: System drive letter not specified.
    echo Please rerun this batch file and specify the system drive letter.
    echo.
    echo Command-line reference:
    echo    system_copy [drive_letter] [account_username] [virtual_device's_name]
    goto :EOF

:error2
    echo.
    echo ERROR: User account name not specified.
    echo Please rerun this batch file and specify the User account name.
    echo.
    echo Command-line reference:
    echo    system_copy [drive_letter] [account_username] [virtual_device's_name]
    goto :EOF

:error3
    echo.
    echo ERROR: Virtual device's name not specified.
    echo Please rerun this batch file and specify the AVD name.
    echo.
    echo Command-line reference:
    echo    system_copy [drive_letter] [account_username] [virtual_device's_name]
    goto :EOF

:error4
    echo.
    echo ERROR: AndroidEmulator folder '%tmp_path%' does not exist.
    echo Please verify that the AndroidEmulator folder has been created at '%tmp_path%' then restart this batch file.
    goto :EOF

:error5
    echo.
    echo ERROR: Temporary .img file does not exist.
    echo Check to see if the virtual device is running, then rerun this batch file.
    echo.
    echo Command-line reference:
    echo    system_copy [drive_letter] [account_username] [virtual_device's_name]
    goto :EOF

:copyerror-0
    echo.
    echo COPY ERROR:  There was an unknown copy error.
    echo.
    goto :EOF

:copyerror-1
    echo.
    echo COPY ERROR:  No files were found to copy.
    echo.
    goto :EOF

:copyerror-2
    echo.
    echo COPY ERROR:  The user pressed CTRL+C to terminate xcopy.
    echo.
    goto :EOF

:copyerror-3
    echo.
    echo COPY ERROR:  Initialization error occurred. There is not enough memory or disk space.
    echo.
    goto :EOF

:copyerror-4
    echo.
    echo COPY ERROR:  Disk write error occurred.
    echo.
    goto :EOF

:copyerror-5
    echo.
    echo COPY ERROR:  No files were found to copy.
    echo.
    goto :EOF


rem EOF

copy and paste the above code into your favorite text editor and save it as system_copy.bat.

Place this batch file in the parent directory for the virtual device's avd directory.

To run it, while the virtual device's avd is running:

  1. Bring up a cmd prompt
  2. Goto the directory that the batch file is in
  3. Execute the batch file with the following command syntax:

system_copy *[drive_letter]* *[account_username]* *[virtual_device's_name]*

example:

 system_copy C "The WABBIT" Nexus_7

That's it. Hope this helps others.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.