Root Your Emulator

First Way:

Okay, so after doing  a lot of searching on the topic, I noticed that a lot of information on rooting an Android SDK emulator for testing, are either inaccurate or out-dated. Mostly just seeing questions on places like Stack Overflow. Not acceptable peoples!!

So I played around with it and made this nice little tutorial. The issue that most people have is either one of two diffrent errors.

  • “failed to copy ‘su’ to ‘/system/xbin/su’: Read-only file system” or
  • “failed to copy ‘su’ to ‘/system/xbin/su’: Out of memory”

Both of these errors have to do with how the file system is mounted. This can easily be resolved by running adb remount after the emulator is run. However you will need to start the emulator with a partition size of 512. Or at least 512 works best for me. Below is a tutorial on how to accomplish this in two different way. Hopefully one will work for you.

You will need to download the su binary and the Superuser.apk.  You can download the su binary and Superuser.apk from this location for now.

http://androidsu.com/superuser/

This may change at some point so if the link above doesn’t work, you can just Google for the two files that you will need:

Superuser.apk and su.

After you extract the .zip file, you will find the necessary files in this location:

systemappSuperuser.apk

and

systembinsu

The easiest thing to do is copy them to your SDK platform tools directory.

cd C:androidandroid-sdk-windowsplatform-tools

Now there are two different way to install the su binary. Keep in mind, this will need to be done everytime you restart the emulator.

Method One:

 This assumes you followed the previous steps.

1. Open Eclipse.

2. Open Command Line (cmd) and go to path there your android SDK located:

cd C:androidandroid-sdk-windowstools

3. Now we will run Emulator with given partition size, enter following command:

emulator -avd EmulatorName -partition-size 512

NOTE: EmulatorName – is the name of your emulator. You can find this in the AVD Manager in Eclipse.

You may also get an error that says:

From my experience, you can ignore this error.

Wait until emulator starts and minimize Command Line and Emulator, but don’t close them.

4. Open a new Command Line (cmd) and go to path:

cd C:androidandroid-sdk-windowsplatform-tools

5. Run the command

adb remount

You should get a succeed message.

6. Then run the following commands:

adb push su /system/xbin/su

If successful you will see the transfer rate message.

7. Next Run the following commands:

adb shell chmod 06755 /system
adb shell chmod 06755 /system/xbin/su
adb install Superuser.apk

If you are following these steps for the second time, you will get this message.

This is okay. The Superuser.apk will not uninstall when you restart the Emulator. If you are doing this to regain su access, you don’t need to re-install Superuser.apk, you can skip the install step.

8. After you run the commands you can verify su access by opening running the Superuser app from the emulator, if all is successful, when you try to update Superuser, you will see this message:

Method Two:
1. Open Eclipse.

2. Open Command Line (cmd) and go to path there your android SDK located:

cd C:androidandroid-sdk-windowstools

3. Now we will run Emulator with given partition size, enter following command:

emulator -avd EmulatorName -partition-size 512

NOTE: EmulatorName – is the name of your emulator. You may also get an error that says:

From my experience, you can ignore this error.

Wait until emulator starts and minimize Command Line and Emulator, but don’t close them.

4. Open a new Command Line (cmd) and go to path:

cd C:androidandroid-sdk-windowsplatform-tools

5. Run the command

adb remount.

You should get a succeed message.

6. Go to Eclipse and open

Window -> Open Perspective -> Other …

Select DDMS in the opened Dialog.

7. Select “File Explorer” tab.

Select directory systemxbin

8. Select “Push a file onto Device”  It’s the picture of the arrow pointing to the phone in the upper right hand corner.

Select “su” , and click okay.

9. Go back to the command prompt. (cmd). Use the one that you ran the adb remount on.

You should still be in the platform tools directory.

10. Now you want to install Superuser.apk

First run:

adb shell chmod 06755 /system

adb shell chmod 06755 /system/xbin/su

11. Next install Superuser.apk

adb install Superuser.apk

You should see the above message.

After this is completed, you can verify the install by accessing the the emulator and running Superuser, and attempting to update. If you have an old version you can update, or it might tell you you already have the updated version.

The Superuser.apk will not uninstall when you restart the Emulator. But you will have to install the su binary each time you shut down the emulator and restart it.

Hopefully this help. It worked for me :-) .

Second Way:
EmuTempRoot – Root tool for Android Virtual Device
This is my tool to apply a temporary root to the (already open) android’s emulator. If you’re a developer or simply want to run apps with root access in the emulator you may find this useful.

The emulator can also be launched from this tool;
this option is recommended since the AVD will be automatically configured in order to ensure a succesful root process.
You can still deploy apps to the emulator from eclipse.

Requirements:
– Windows Vista (it should work on XP and 7, but not tested)
– .NET Compact Framework 3.5 or higher
– Android SDK for 2.1 or higher

Usage:
– Unzip to desktop or any folder where special rights are not required
(e.g. do not unzip to the program files folder)
– Open EmuTempRoot (double-click)
– Open the AVD (better to open AVD from EmuTempRoot)
– Root! it lasts untill the AVD is rebooted

xda

Click the below link to download file

http://www.mediafire.com/?t89uoc8tgf02r2n