Monday, May 13, 2013

How To Run Custom Rom In Emulator

How to use Android Emulator to test custom ROMs

It is tested on XPERIA X10 . it should be work on other android devices.

Follow these steps to run custom rom in emulator.

1. Download the latest Android SDK.
2. Open the archive, and copy the folder android-sdk-linux-x86 to a safe place. You can also rename it to an easier name. Example : I placed it in ~/Home and renamed it androidsdk.
3. Go to the SDK folder, then in the folder Tools/. Double-click on Android and choose Run.
4. Go to Available packages, and choose to install (choose at your will !)
  • Android SDK Tools, revision 8
  • Android SDK Platform-tools, revision 1
  • SDK Platform Android {VERSION(S) YOU WANT} (!) You need at least one Platform. For X10, you can download 1.6, 2.1. You can also add 2.2, 2.3.
Once it's done, close the window.
5. Download Xperia X10 add-on for SDK. (?) Read the PDF add-on guide, it is helpful !
Copy the folder (from the archive) XPERIA-X10_r1 inside the folder add-ons of your Android SDK folder ({androidsdk}/add-ons/).
6. Run terminal, go to your Android SDK folder, then in tools folder, and run
Code:
./android list target
.
Note the id number of the Android you want to develop (ie for me, Android 2.3 is
Code:
id: 3 or "android-9"
). (?) You might also want to note the name ("android-X") as it might be useful later.
7. Now, create AVD (a profile for emulator). Usual command (assuming you are INSIDE the /tools/ folder !) is
Code:
android create avd -n NAMEYOUWANT -t {ID}
So, for us, it will be
Code:
./android create avd -n myx10 -t 3
8. To generate the AVD, you will be prompted several info. Type these for Xperia X10 :
  • Create custom hardware profile : yes
  • SD Card support : yes
  • Asbstracted LCD density : 160 (correct if I'm wrong ?)
  • DPad support : no (?)
  • Accelerometer : yes
  • Max camera pixels (H) : 3264
  • Cache partition size : 66 (?)
  • Audio playback : yes
  • Trackball : no (?)
  • Max cam pixels (V) : 2448
  • Camera support : yes
  • Battery support : yes
  • Touch screen : yes
  • Audio record : yes
  • GPS : yes
  • Cache partition : yes
  • Keyboard : no
  • heap size : 32
  • RAM : 280
  • GSM Modem : yes

(?) I recommend you to create one profile for each Android version you want to run (so : you just have to change the ID, and create same profile). If you don't, you won't be able to run custom ROMs using other versions of Android (ie your AVD profile is 2.3 and you run a 2.1 custom ROM).

9. Done ! Take your custom ROM (downloaded, compiled... In this case, files are in {YourAndroidRepoFolder}/out/target/product/generic/. It comes with about 3 files, including a file called system.img. Copy this file into the folder (hidden) .android/myx10{In fact, the name you've chosen earlier "NAMEYOUWANT"}.avd/
10. Run terminal, go to Android SDK folder/tools/ (if you didn't close your current terminal, you're already in  and run this command to run emulator WITH your custom ROM :
Code:
./emulator -avd myx10{again the "NAMEYOUWANT" you've chosen before}
Wait and enjoy !

(?) First boot is long - it's NORMAL. Just like on a real device, the OS will be cached and will work faster and faster.

No comments:

Post a Comment