Android TV Emulator: Wrong Orientation - android-studio

When I create a new Android TV virtual device from the AVD Manager and launch it in the emulator the orientation is all wrong (see image). How do I get it to start in landscape?
Image: Android TV Emulator - Wrong Orientation
The config.ini for the device:
avd.ini.encoding=UTF-8
AvdId=Android_TV_1080p_API_23
abi.type=x86
avd.ini.displayname=Android TV (1080p) API 23
disk.dataPartition.size=200M
hw.accelerometer=no
hw.audioInput=yes
hw.battery=no
hw.camera.back=none
hw.camera.front=none
hw.cpu.arch=x86
hw.dPad=yes
hw.device.hash2=MD5:f26df701fd74415b9a435e3e607b5d8a
hw.device.manufacturer=Google
hw.device.name=Android TV (1080p)
hw.gps=yes
hw.gpu.enabled=yes
hw.initialOrientation=landscape
hw.keyboard=yes
hw.keyboard.lid=yes
hw.lcd.density=320
hw.mainKeys=yes
hw.ramSize=1536
hw.sdCard=yes
hw.sensors.orientation=no
hw.sensors.proximity=no
hw.trackBall=no
image.sysdir.1=system-images\android-23\android-tv\x86\
runtime.network.latency=none
runtime.network.speed=full
runtime.scalefactor=auto
sdcard.path=C:\Users\Emil\.android\avd\Android_TV_1080p_API_23.avd\sdcard.img
skin.dynamic=yes
skin.name=1920x1080
skin.path=1920x1080
snapshot.present=no
tag.display=Android TV
tag.id=android-tv
vm.heapSize=128

When you create the TV emulator, it is in portrait mode by default.
To change the orientation to landscape, press numpad 9 key that is on right hand side of keyboard.

Change hw.initialOrientation to portrait, mine works with this configuration.
I guess the emulator sees 1920*1080 as default portrait, so it becomes 1080*1920 in landscape mode (which is actually portrait).
If you're creating AVD using Android Studio, you should select the 4th one, instead of 3rd one. It gives you a nice device frame and boots with a landscape screen.

Related

Android Virtual Keyboard affect screen rotation ( Using Cocos Creator to build )

I using Cocos Creator 3.5.2 for this project.
When I start testing input text field in android phone either in app or web browser, after the virtual keyboard appear and I try rotate screen from landscape to portrait, the keyboard got change but the screen layout dint resize still is landscape but only smaller n at top.
It need to close the keyboard then the screen layout will start resize and this is in app.
Any idea that can cause this happen?
And any solution for it.

how can I get the exactly right size screen emulator in Android Studio?

I'm working with flutter in Android Studio in windows.
I set the screen size 768*1024(ipad mini size) when I create my virtual devices in android studio, but I find the height is smaller than expected. Actually when I call function window.physicalSize it shows that the size is 768*796.
I have gotten the fact that the function only shows the size of the screen that flutter can render.(So the hidden part is about what? bottom navigation bar,including three buttons, back, home, and the other one, or something else, I'm not sure.)
So, the question is how can I get exact size screen I want(768*1024)?

After upgrading to Android Studio 2.0, I cannot change the screen orientation in the Android emulator

Recently I upgraded the Android Studio from 1.5.x to 2.0 stable version.
Before the upgrade I was changing the screen orientation with the Ctrl + F12 or Ctrl + F11 keyboard shortcut but now it doesn't work in the 2.0 version. I also tried Numpad 7 and Numpad 9 (with the numpad on or off) but without success.
Yes, I'm aware that the new Android AVD interface contains a sidebar with various functional shortcuts which includes Rotate left (Ctrl + Left) and Rotate right (Ctrl + Right) icons but it rotate only the the device not the mode (Landscape or Portrait) as it showed in the image below:
How can I change emulator screen orientation to landscape or portrait in the new Android Studio 2.0?
P.S. Please do not mark my question as duplicate, I tried all the solutions from How do I change screen orientation in the Android emulator? and How to rotate the Android emulator display? as those questions were valid for earlier versions of Android Studio.
P.P.S. I'm using Ubuntu 14.04 operating system on a Samsung R530 notebook.
It seems to be a bug. Please check out https://code.google.com/p/android/issues/detail?id=206262 and report the observed behavior.
Edit: Fixed in SDK Tools 25.1.6
This is not a real solution, but if anything don't work, it's good workaround. Just add screenOrientation property to activity in the Manifest file.
<activity
android:name=".MainActivity"
android:screenOrientation="landscape"
/>
After upgrading my operating system from Ubuntu 14.04 to Ubuntu 16.04 the bug disappeared and the Rotate left (Ctrl + Left) and Rotate right (Ctrl Right) works fine.

Android Emulator on OS X with Retina Display

I'm trying to use Android Emulator on Macbook Pro with retina display (and an external 4K display with 2x pixel scaling). I've tried all the possible settings in Android AVD Manager, but emulator always shows a blurry non-retina image. It seems that it treats the display like if it is 1920x1080 instead of 4K thus 1:1 pixel mapping actually happens to be 1px on device = 4px on the display.
Is there any way to make it work well?
Thank you
(I'm using OS X El Capitan and Android Studio 1.4.1)
Answering by myself — seems that it just works now with the Android Studio 2.0.

Virtual buttons not appearing on emulated Android 4.2 system

I have created an Android 4.2 AVD. For the need of my current project, the main screen orientation is landscape. The software keys option is selected.
The mode is set to xhdpi, like a Galaxy Nexus phone.
As I start the emulator, I see a black stripe on the right where the buttons should appear, but it remains black. Thus, there is no way to trigger a Back action since the emulated physical keys are disabled.
The problem can be fixed by configuring the emulator in portrait mode then rotate it once started; the buttons appear as expected. This causes problems since the window is automatically scaled down to fit on my monitor; I did not find any shortcut to restore 1:1 scaling at runtime, after the rotation is done. This is important since I would like to see pixel-perfect results.
I am using SDK version 21 and platform-tools version 16.0.2, as updated yesterday.
Found the solution myself... this is a workaround that allows getting 1:1 scale and the software buttons working.
Leave the AVD (Galaxy Nexus or cloned from it) on portrait mode.
Run the emulator from the command line, using the -scale 1 option; this is the magic that forces 1:1 pixel perfect ratio even if the window does not fit in screen at startup. By default, automatic downsizing happens to fit the monitor.
Rotate the display using Ctrl+F11 or Ctrl+F12 to get landscape mode.

Resources