Change layout of emulator in Android - android

I'm newbie in Android application development. I just downloaded all SDks and Eclispe. Then I created sample project with the help of some online tutorials. On running the project for the first time it asked me to set virtual emulator and I then set some arbitrary values for layout (I guess 700), now when I run the project every time the emulator size is so big that it doesn't fit im my computer screen.
How can I change the settings for emulator? also my emulator gets hanged and says not responding, any suggestion will be appreciate.
Apologies if the question is silly, I'm just trying out my hands at Android.

It sounds like you are starting an API level 11 or 12 emulator. This can be very slow to start. To fix the display size start the emulator from the SDK manager icon and select the option 'scale display to real size'

Pramodtech... on Eclipse you can set the scaling factor from 0.1 to 3.
Go to Run --> Run Configurations...
--> Target tab
--> Scroll until you see Additional Emulator Command Line Options
--> enter -scale <0.1 to 3>
--> Apply
If you want to change the screen size:
Go to Window --> Android AVD Manager
--> Virtual Devices Select AVD
--> Select Edit
--> Select Skin: Built-in HVGA (for 160)
--> Edit AVD to save.

You can close your emulator, open the Android AVD manager (by clicking its icon in the Eclipse toolbar), and then edit your AVD's resolution.
-A
P.S. AVD = Android virtual device

Related

android studio/eclipse emulator showing only part of screen

Since the last upgrade of packages, the Android Studio/Eclipse emulator shows only a fraction of the screen.
How can I view the whole screen again?
To re-install Eclipse does not help.
Two different settings influence the display size of a virtual device. The actual hardware display size of the specific hardware being emulated (Nexus One, Nexus S, ...) and the scaling factor that the emulator applies when rendering that display onto your computer screen. Both are properties of the virtual android device, so reinstalling Eclipse will not change them, but you can edit them in the Android Virtual Device Manager or on launching your emulator.
If you run your emulator from the command line, the third paragraph of the command line help page describes how to change both settings.
If you run your emulator from Eclipse, you may want to look at the launch configuration that you use for debugging your application. At the very bottom you can give the scaling factor and other properties as additional command line arguments. Make sure this is not set.
If nothing worked until here, just create a new virtual device for your emulator from the Eclipse toolbar.
First this seemed the solution: creating a new virtual device in Android Studio solved the problem.
The same problem re-appeared today in Android Studio. I found the definite and simple soluion. You can set it explicitly in the Android Studio AVD manager.
How? Start Android Studio, menubar "Tools" > "Android" > "AVD manager". Then set the startup size and orientation. I changed it from "Auto" to the one below:

How to create Android-M Preview emulator?

I think I have installed all the system images required for android m preview, but still my emulator is showing nothing, its always blank. Please help me
After Suggestion i have downloaded the other requirements, but still its not working
You have sufficient files to create the emulator might be you are editing the existing emulator, i suggest try to create a new emulator, and try to keep the Ram consumption lower to get better performance.
Refer from the above link you can create your new emulator by following below steps
Step-1: Go to Android SDK folder and run AVD Manager. Click on Create
Note: Use default value for Max VM application heap. As Android supports variety of displays, you can explore with different devices by selecting in Device: dropdown
Step-2: Select the virtual device which you just now created and click Start
Step-3: Do not make any change under Launch Options and click on Launch button
Step-4: Emulator will start a few Command Prompt windows flicker. You should now see the following screen, with the Android device booting up, which will take about five minutes
Step-5: You should now see a screen saying Emulator has been successfully installed
Your Windows/Mac PC should now be ready to get started with the Developer Preview.
Go to Android SDK manager you need to download the Android m preview section.Then follow these steps
Step 1: Run AVD Manager and click on Create.
Note : Select a small resolution screen if your RAM is low.It will be a plus in case of performance part.
Step 2:Enter the Ram value to 1Gb if your system(Computer)RAM is about 4gb or RAM value as 2gb your system(Computer)RAM is about 6gb or 8gb.
Step 3:Select the device which you created now, press Start and select Launch Button.
Step 4:You should get a alert box showing that Successfully installed.
Step 5:An android device with android device booting up screen will be appeared and it will take time depending upon the RAM you allocated at the time of creating the Android Device in AVD.
NOTEmake sure not to run too many another programs while you trying to launch or using the emulator.(make sure the IDE is uptodate)
Happy Android M Preview....
If you want to create MNC(Android M Preview) emulators, you could follow these steps:
1, Of course, downloads MNC System images. Open SDK Manager, select images like Android TV Intel x86 Atom System Image, ARM 64 v8a System Image, ARM EABI v7a System Image and something like that.
2, open AVD Manager by clicking the button on the top of Android Studio. Then you will see "Your Virtual Devices" window.
3, Click the button of "Create Virtual Device" at the left bottom of the window. Then you will see "Select Hardware" window.
4, then select the category and name of the emulator you want, and then "Next".
5, if you have succeeded downloading MNC System Images, you will see them from the "API Level"
6, and then click "Next", you will see "Android Virtual Device(AVD)" window, you can change settings if you want to.
7, click "Finish" and wait, util emulators are prepared.
I had the same problem,
I copied the system image from the default directory:
C:\Users\eli\Downloads\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\system-images\android-MNC\default\arm64-v8a
to the image root dir:
C:\Users\eli\Downloads\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\system-images\android-MNC\arm64-v8a
I restarted eclise, and now, I could see the android M and the arm64 system image.

How can I resize the AVD emulator window in Android Studio?

I've seen many posts asking about how to re-size the AVD emulator window, however, I have not found any that work. My emulator is off the top of my computer screen, and I cannot resize it.
How can I resize the AVD emulator window in Android Studio?
After the Android Studio 2.2 update, there is no Emulator Tab in Edit Configurations window.
If you want to scale your emulator, you just need to use this keyboard combination:
To scale up: Ctrl + ▲
To scale down: Ctrl + ▼
If what you want is scaling by a percentage or getting a 1:1 display, maybe you should try modifying these two files:
(I don't know if this one will work since I didn't have a chance to try.)
C:\Users\YOUR USERNAME.android\avd\Nexus_XX_API_XX.avd\hardware-qemu.ini
C:\Users\YOUR USERNAME.android\avd\Nexus_XX_API_XX.avd\hardware-qemu.ini
Update for 2022:
Please see this answer if the above method doesn't work for you.
With Android Studio 2 now you can resize your window simply by dragging a corner.
You can resize your emulator screen
By going (in the top menu of Android Studio) to Run > Edit Configurations
In the left panel of the just opened dialog, choose your application.
In the right panel, choose the General tab, and then go down and check Emulator, and in Prefer Android Virtual Device, choose the virtual device you are currently using.
Now, go the tab Emulator (next to the General tab), and in Additional command line options, write
-scale 0.X
where X can be for example 25 or 50, which would represent respectively 25% and 50% of original size.
On emulator window, go to settings via "..." at the bottom and then choose Settings tab which second from bottom and toggle "show window frame around device"
Then resize with your mouse
Try this on Android Studio:
Go to Run
Click Edit Configurations
From left side, under the Android Application tab, select name of your application
Now, from General tab (in the right panel), go down and check Emulator, and select one emulator from Prefer Android Virtual Device list
Click on the Emulator tab, and in the entry box Additional command line options, change the scale of the emulator to something of the form -scale 0.X (where X could be for example 40, if you want your emulator to be 40% of the full size)
Click Ok to save these settings
Edit : On Android Studio 1.5 , this options are removed. Good News is we can directly change the size of the emulator from Android Studio 2.0 (As shown in the introduction video)
Probably a duplicate but my step by step on what I did to get this working.
Environment Windows 10 64-bit on Surface 3 i7 8g ram w 512g hard drive.
Run HAXM config in {android sdks}\Intel\Extra
Gave it 4 gig of ram
verified its working by going to an admin prompt and running 'sc query intelhaxm'. Status of 4 verified it was happy.
Ran Android Device manager and deleted all images present.
Created new image targeting KitKat 4.4, wqith 768mb of ram
In emulator set scale to be "4 dp to 1 px onscreen"
You'll have to experiment for your particular resolution.
Started the emulator from the device manager. Comes up FAST, and non-docked, and clickable.
Screen shots below.
Healy in Tampa.
On Android Studio 4, you can enter zoom mode by clicking this button. After dragging the window to the desired size, you can exit zoom mode by clicking it again.
I have gone through this same issue and recently got perfect solution.
While you creating your own virtual device there is an option for "Start-up size and orientation" ,the default of which is "auto"
You need to select another value according to your need from the drop-down menu and voila...
This worked for me and wish will work for you too.
Android Studio 1
Got to AVD Manager
Under Actions for the device you want to change
click "Edit this AVD"
Change Scale setting
Android Studio 2
For step two click on the little pencil on the right.
This solution is going off of what #james04 did with a minor tweak since specifying the scale as -scale 0.X didn't work for me.
Run --> Edit Configurations --> Emulator tab
Check Additional command line options
Type -scale 128dpi (or some other dpi of your choice; will need to experiment a little to get exactly what you want).
So, basically just replace -scale 0.X with -scale XXdpi.
I was getting problem while doing from the methods mentioned.
I will give the way I did, which is different from the given methods.
Follow the steps as given :
Go to Control Panel.
Click on Programs.
Select "Turn Windows feature On or Off".
Check "Telnet Server" and "Telnet Client".
Go to cmd.
Type "cd\" (to move to the main directory).
Now type "telnet localhost 5554" (leaving the quotes and the number is the same as present on top of your emulator).
Now type : window scale 0.x (x as per your requirement eg: window scale 0.5 to get the half screen size).
Hope this helps.
Link : https://www.youtube.com/watch?v=O9bvxlo70IE
!!!! Finally !!!!
For Android studio greater than 2.0
This solution worked for me. Since Emulator tab is not there to scale the screen.
Go to Android virtual device(AVD)
Emulated performance > Graphics - Change it from Automatic to Software.
See Screenshot for better understanding
Open "Task Manager" look for the process running the AVD. In my case "qemu-system-x86_64.exe"
Task Manager Screenshot
Right click on the process and choose "Open containing folder"
Right click the file "qemu-system-x86_64.exe" to open file properties
In the properties window select "Compatibility" tab
Properties window
Select change High DPI settings
enter image description here
Under "High DPI scaling override". Check "Override high behavior" and Select "System"
Worked for me on a surface book
Starting with Android Studio 4.1, scaling the standalone emulator is not possible (or if it is, it's not straightforward), but there is a workaround:
You can configure Android Studio to run the emulator in a tool window, and, within that, the emulator adapts to the available space. If you change the tool window's view mode to "Float" or "Window" (small settings icon in the upper right) you get a fully resizable standalone emulator window. The only difference is the window frame drawn around it.
Android Studio -> Preferences... -> Tools -> Emulator -> Launch in a tool window
Update:
The latest version of the emulator (30.5.3) now also allows you to resize the UI when run in standalone mode. Make sure you select "Show window frame around device" in the emulator settings.
for mac its CMD + UP. Tested on Android Studio 3.1
This is situational for me:
My setup:
MacBook Pro (Retina: 2880x1800) + 27' ASUS Monitor (1920 x 1080) + Startup size and orientation in AVD Manager set to Auto.
There are 2 situations in which I can start emulator:
1) With ASUS monitor attached to Macbook Pro
This results in an emulator window that fits my ASUS monitor in height. If I move the emulator window over to MacBook - it does not resize properly - part of the emulator window is hidden.
2) No monitor attached to MacBook Pro
This results in an emulator window that fits my MacBook Pro in height. This is ideal because I can now reattach the big ASUS monitor and the window is still a comfortable size.
This leads me to conclude that in the case of multiple displays - Android Studio philosophy is to pick the largest size and size the Emulator window accordingly.
So I guess Android Studio bug fix/enhancement can be to reset emulator window size based on detecting a different resolution when it is moved between displays of different resolution/dpi/ppi.
I have submitted a bug report to AOSP here:
https://code.google.com/p/android/issues/detail?id=187327&thanks=187327&ts=1443045686
With older versions of Android Studio, adding -scale 0.5x to the additional command line options worked like a charm.
But with Android Studio v1.5.1, The Emulator tab is missing in the Rn/Debug Configurations window.
Has anyone else encountered the same thing?
As of now, I'm starting the emulator from Command Line with the -scale option to make it work.
./emulator -avd NEXUS_9_API_19 -scale 0.4
Concerning the resizing, there are plenty of good answers here. But for moving the emulator window with the keyboard it is as easy as pressing [ALT] + [Spacebar] and move the window around with the arrows.
This is a good trick for any kind of apps.
Yet another way in AndroidStudio. Open the terminal from the bottom status bar.
Enter the following, changing the path and avd name to match your environment.
C:\android-sdk\tools\emulator.exe -scale 0.25 -netdelay none -netspeed full -avd Nexus_6_23
Note: The scale can be refined as needed
Unfortunately, -scale and -dpi-device flags have been deprecated with Emulator 2.0.
(http://tools.android.com/recent/emulator20previewreleasenotes)
25.0.7
Add warning messages for deprecated window size flags. ("-scale" and "-dpi-device")
25.0.6
The deprecated “-scale” parameter will now be ignored. (b.android.com/200522)
25.0.5
Removed the "-scale" flag and "window scale" commands. (b.android.com/199843)
I think the best workaround for now, modu's answer. The usage CTRL+ Up and CTRL + Down
For those who want a cmd line way, create a shell script (this example uses window_scale.sh) in your path with this content:
#!/bin/bash
if [ $# != 1 ]; then
echo usage: $0 scale
exit 1
fi
echo "window scale $1" | nc localhost 5554
Then just type the following command to resize the window to whatever you want:
$ window_scale.sh 0.4

How to add emulator for tablet(7inch,800x480) in Eclipse?

Today is my first day with Android.
My need is very specific. I want to develop a application for a 7inch tablet with resolution 800x480.
Though I was able to add Emulator for Samsung Galaxy tab, its resolution is different, that the reason that's not helping me that much.
Can any body please help me.
You have to open Window > AVD Manager, create a New emulator, name it and set the screen size, heap size and android version.
I should add that you should then go to Run > Run Configurations and set your current project to run with the new emulator.
see yellow color highlighted box to specify target device resolution on avd on time of creation of avd.
To change orientation you have to use Ctrl + f12

How to resize the AVD emulator (in Eclipse)?

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)?
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 the additional 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.
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.
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.
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.
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 .
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
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.
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.
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.
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.
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 .

Categories

Resources