How to resize the AVD emulator (in Eclipse)?
AndroidEclipseEmulationAndroid Problem Overview
I'm writing my first Android app for a small business that has some Droid phones. I set up an AVD for the phone with the right resolution: 854 pixels high.
I'm working on a MacBook Pro with a max screen resolution 900 pixels high, so when the emulator starts up, the bottom is cut off.
Is there a way to scale the emulator display down to 75% or something so that it fits on my screen? Any other solution (other than running everything on the phone itself)?
Android Solutions
Solution 1 - Android
This is actually possible from your project as well, no need to start the emulator through the AVD manager:
-
Go to
Run > Run Configurations
... > (Select your application on the left hand side) > (Click the"Target"
tab on the right hand side). -
At the bottom there, you'll see
Emulator launch parameters
. In theadditional emulator command line options
, add'-scale 0.75'
(to make the screen 75% of full size)
Next time you start the emulator it will have scaled properly.
Solution 2 - Android
From within Eclipse
:
-
Go to
Window > Android SDK and AVD Manager > Virtual Devices
-
Select the AVD you want to launch and click
Start
-
Check the
Scale display to real size
button -
Enter how big you want it to appear in inches and press
Launch
. For this to work, you'll have to also enter a reasonable approximation of your mac's screen resolution. I'm using 7 inches and 113 dpi for my 13" Macbook Pro, but you may be able to get away with 8 or 9 inches.
Solution 3 - Android
There is also a way to re size the emulator through a windows command prompt.
- From command prompt run:
telnet localhost 5554
window scale 0.75
quit
Assuming there is one emulator running with on port 5554.
Solution 4 - Android
The telnet answer above is great for Android Studio developers. I just wanted to add that the window scale command will take either a scale factor OR the dpi which may be easier for many people (measure once and it should work for you ADV which are 1dp:1 pixel)
telnet localhost PortNumOfAVD
window scale 96dpi
quit
Note telnet is not installed on windows by default anymore.
Solution 5 - Android
For Changing the window size of the Android Emulator
Append the parameter -scale <scale factor>
to the Emulator launch parameters. In eclipse, put it in the field "Additional Emulator Command Line Options" within the Run Configuration.
Allowed scale factors are those between 0.1 and 3, although the most common will probably be -scale 0.5
.
Solution 6 - Android
If you are working with Eclipse, than here's is what you can do if the size of the emulator is too big for you screen:
- Run > Run Configurations
- Pick the "Target" tab
- Scroll down to "Additional Emulator Command Line Options" and put in: "-scale 0.7" or another number
This will keep the AVD scaled even if it is started automatically by Eclipse.
Enjoy
Solution 7 - Android
If you launch your emulator outside of Eclipse, using the android
command, you will be able to scale the screen as part of the launch process. Not sure how to do that in Eclipse, though.
Solution 8 - Android
I definitely recommend running the emulator through terminal or command line because it allows you for much better control.
For example, if you want to run emulator in different size, you just need to run it like this.
~/Android/Sdk/tools/emulator -scale 0.35 -avd Nexus_5_API_23
Nexus_5_API_23 corresponds to existing AVD on my host computer. When you create different Android Virtual Devices, you can just replace it with name of your device and it works. So basically you just run emulator from Android SDK's tools directly. You can also add other parameters like netdelay, netspeed etc.
Solution 9 - Android
The command to open in Command Prompt is given below
- emulator -avd
[- for details see http://developer.android.com/tools/help/emulator.html
To open a desired size emulator window follow the below command
- emulator -avd "AVD_Name "-scale "Scale_Value"-dpi-device "dpi"
Example:
- emulator -avd "AVD_Name "-scale auto -dpi-device 160/200.
So just change the dpi-value according to your need. Hope u enjoy.
Solution 10 - Android
Another option would be to use the GenyMotion emulator, where you can actually resize the emulator window in real time. It is also much faster than the stock emulator.
Solution 11 - Android
You can permanently change window size of emulator by changing in config.ini file of avd
For that you need to follow this path
- First go to your android #home directory
- Then go to .android folder
- Then avd folder and go to your avd named folder
- you will see config.ini file
In config.ini file change the value of skin.name and skin.path to your conveniency. I have set it to 480x600 .