Android - Emulator in landscape mode, screen does not rotate
Asked Answered
H

26

199

When I switch to landscape mode (NUMPAD 7 or CTRL+F11) the emulator rotates the screen to landscape orientation but the Android OS and none of the apps rotate. So everything is sitting sideways. Is there something in the AVD configuration that needs to be set in order for the device to rotate properly?

enter image description here

Hormonal answered 12/9, 2011 at 21:47 Comment(10)
Wow i've never seen that before...is your program still running in the background?Szymanski
I believe it's a bug with 2.3 + emulator. Try 2.2.Sherellsherer
As that's on the home screen that's exactly what I'd expect to see. I don't use the emulator but my HTC Desire doesn't switch orientation on any of the home screens when I rotate.Anchises
It doesn't rotate for the home screen or any app or menu, etc. It appears to only do this for the Google APIs (Google Inc.) 2.3.3 API Level-10 AVD. The normal Android 2.3.3 seems to rotate as expected. Not sure if this is a bug or what.Hormonal
#4535798Alphonso
I can confirm this. The emulator for Android 2.3.x (2.3.3 and 2.3.1) doesn't handle screen rotation. However, the emaultor for Android 2.2 does handle screen rotation.Teamwork
Android emulator 2.3.3 does not contain this bug.Armistice
I have the same problem with Android 4.1 (Google) emulator. Switching keyboard off does not help.Barbour
I had this problem with an API 4.3 "small phone" and none of the suggestions here worked. However, the big tablet starts horizontally and will (sluggishly) reorient.Macaco
See instructions here for manually rotating: https://mcmap.net/q/129745/-android-emulator-screen-rotationAlmund
F
61

It is a bug with the 2.3 and 4.4 emulators.

http://code.google.com/p/android/issues/detail?id=13189 [v2.3] https://code.google.com/p/android/issues/detail?id=61671 [v4.4]

Fessler answered 2/4, 2012 at 7:17 Comment(7)
The problem still happens w/ the Android 4.4 emulator for me as well. Someone else reported it in that thread too :-PPredicative
Yes, the problem still exists in Android 4.4.2 emulator. It simply rotates the screen and does not display the corresponding layout file under the corresponding res/layout folder. I have verified this by running in a nexus device where it works as expected.Newel
Android L emulator also has this problem.Jeer
As a workaround disable the "Hardware keyboard present" checkbox in the "Edit Android Virtual Device (AVD)" window as @Hatchery sais in https://mcmap.net/q/127481/-android-emulator-in-landscape-mode-screen-does-not-rotateBeading
Like if you still see the problem in 2018Doleful
Still happening in 2020.Unbind
The valid answer to this issue for 2021 is https://mcmap.net/q/127481/-android-emulator-in-landscape-mode-screen-does-not-rotateSoult
L
209

Another answer here:

in my case the problem was simply that the auto-rotate setting in the android emulator settings (accessible pulling down the notification bar) was disabled, my bad.

Lumpfish answered 27/9, 2018 at 11:52 Comment(8)
Doh! That was my problem too, I feel like a dummy. I'm new to Android (used iOS for years) and have realized that auto-rotate is enabled by default on iOS, but disabled by default on Android.Punctual
This. I feel that Locked Rotation shouldn't be the default as it throws a lot of new developers off.Moreno
looks like that's the default setup which is honestly dumb, seeing that I don't know that's disabled without digging into the settings. Google should fix this so that it's on by default.Soult
Besides this, I had to restart my Emulator for it to rotate.Hesta
I've spent way too long on this and it's not even finning. I developed most of my app functionality thinking that rotation is disabled for my app until I realized that it isn't as I put it on a tablet for testing :facepalm: OMG...Radioisotope
2023 and still the same broken default setting. But @abidibo's insight, continues to save us all.Ligation
Thanks man, searched for hours why onConfigurationChanged was called in API 34 but not in API 28 or 31 in the emulator. Turns out they changed the default for auto orientation :-(Preschool
This was the answer for me. I kinda feel silly that I had to turn on the rotation setting on my physical device to make it work, but didn't think the emulator would have is disabled by default as well and need it turned on. Thanks!Vasti
S
101

I spent more time then I'd like to admit scratching my head why my app was rotating fine on my device but not in the emulator... in the emulator pull the drop-down OS menu and make sure "auto-rotate" is enabled. emulator screenshot

Strapped answered 12/9, 2020 at 15:17 Comment(5)
thanks. Spent 1h looking for the problem and it was as simple as thisBookstack
this should be the accepted answer! it's insane, that the default emulator setting is to lock screen orientation...Malt
lol , so helpful for me right now . thanksSikhism
lol, nice touch 👌Goldofpleasure
even very simple perform I didn't know. foolAnodyne
H
63

In my case it was solved by disabling the "Hardware keyboard present" checkbox in the "Edit Android Virtual Device (AVD)" window.

Hatchery answered 20/4, 2013 at 14:25 Comment(2)
This worked for me with a Honeycomb emulator that was behaving the same way.Coffer
This solved the problem for me when creating an Android 3.0, API 11, Android Virtual Device.Schappe
F
61

It is a bug with the 2.3 and 4.4 emulators.

http://code.google.com/p/android/issues/detail?id=13189 [v2.3] https://code.google.com/p/android/issues/detail?id=61671 [v4.4]

Fessler answered 2/4, 2012 at 7:17 Comment(7)
The problem still happens w/ the Android 4.4 emulator for me as well. Someone else reported it in that thread too :-PPredicative
Yes, the problem still exists in Android 4.4.2 emulator. It simply rotates the screen and does not display the corresponding layout file under the corresponding res/layout folder. I have verified this by running in a nexus device where it works as expected.Newel
Android L emulator also has this problem.Jeer
As a workaround disable the "Hardware keyboard present" checkbox in the "Edit Android Virtual Device (AVD)" window as @Hatchery sais in https://mcmap.net/q/127481/-android-emulator-in-landscape-mode-screen-does-not-rotateBeading
Like if you still see the problem in 2018Doleful
Still happening in 2020.Unbind
The valid answer to this issue for 2021 is https://mcmap.net/q/127481/-android-emulator-in-landscape-mode-screen-does-not-rotateSoult
U
37

API Level 29 here. By default the rotate is disabled. Pull Down the drop-down of the mobile and enable it.

Unstick answered 17/11, 2019 at 10:20 Comment(1)
Man, that is a life saver. I won't have ever thought about it. :)Burress
Y
20

In my case the Skin option in AVD settings was the problem. When I selected "No skin", it worked.

Yul answered 9/11, 2015 at 12:38 Comment(3)
Skin is the issue on Lollipop and thank you for sharingReproach
This should be nowadays the selected correct answer, thank you Sir.Moffit
Thanks the issue was the same for me as well! CheersDoleful
S
11

I had same problem. Try removing the "Keyboard lid support" option in the settings of the hardwere virtual machine. It helped me.

Shoffner answered 18/3, 2012 at 14:37 Comment(0)
B
9

I made a silly mistake and spent a lot of time for the problem on API 30. Checked Auto-rotate setting and other answers here but tried the rotation on the main Android screen, which is not rotated! You need to open some app (your own or a default one, like 'Messages' or 'Browser') to see the rotation works.
enter image description here

Bathrobe answered 24/3, 2021 at 7:48 Comment(2)
To be clear, the Setting is in the EMULATOR's Settings App, not the side bar "..." settings.Billingsgate
Found it, Android Settings >> Home Settings >> Allow home screen rotationMaraca
A
7

I had to do all the following on an Android 10 device:

  1. verify that I had in config.ini:
hw.accelerometer = yes
hw.sensors.orientation = yes
  1. Set the device to auto-rotate from status bar.

enter image description here

  1. Set the home-screen to auto-rotate

Long press at home screen > "Home settings"

enter image description here

"Allow Home screen rotation" set to ON

enter image description here

Amplexicaul answered 17/2, 2022 at 11:46 Comment(0)
A
6

Once you click the change orientation button, a small icon displays on the emulator asking if you want to change the orientation of the emulated screen. It only displays for a few seconds, so look next to the "bottom" icons and you will see this temporary icon.

This works with the emulator keyboard on or off.

I am running Pixel 2 API 29, Android 10.0 (latest versions as at today)

Applesauce answered 7/1, 2020 at 16:59 Comment(0)
T
5

As of mid 2015 the issue is still open and logged in the android bug tracker here's the link you can check it out https://code.google.com/p/android/issues/detail?id=61671

None of the above solutions worked for me and i am using Android 4.4.2 emulator. As a work around in your graphical layout you can change the orientation and check it out.

Tedder answered 30/5, 2014 at 7:22 Comment(0)
D
4

Is the accelerometer property of the emulator set to True? please check it. if not, set it to true. it should help. its working fine on mine.

Open AVD Manager -> GoTo 'Device Definitions' tab -> Select an existing AVD -> Clone

Downhaul answered 17/10, 2011 at 19:17 Comment(1)
@Jakobud Open AVD Manager -> GoTo 'Device Definitions' tab -> Select an existing AVD -> CloneHalitosis
C
2

I had to install a new virtual device Nexus on API LEVEL 27 On Api Level 28(PIE) I could not rotate the display.

And it works for me. Regards enter image description here

Calyptra answered 6/11, 2018 at 5:50 Comment(0)
F
2

As of API 29, it stops working randomly for no reason. Need to shutdown and restart emulator, then it works again.

Flogging answered 28/4, 2020 at 19:31 Comment(0)
P
1

I got this to work with the latest version of AVD.

Check out the config : Android Config for rotate to work

Also, here is the result: AVD result

I think wha tmakes it click is the combination of keyboard and Skin. Also, if you create your own device make sure you add a Gyroscope sensor.

Photon answered 12/10, 2014 at 14:41 Comment(0)
G
1

You have to use Android 5.1.1, aka API 22, aka Android 5.1 LOLLIPOP_MR1. Download Android 5.1.1 (API 22) in your Android SDK Manager and when you create a new Android Virtual Device select that as your OS.

As war_Hero mentioned, this bug was reported to Google. The bug is now fixed as of Mar 23 '15:

https://code.google.com/p/android/issues/detail?id=61671

Glum answered 3/4, 2015 at 18:9 Comment(1)
The problem is still present on Android 5.1.1Mirage
C
1

In my case you need to click a small button that would enable the orientation to change, right after you press the main change orientation button.

Clipper answered 24/7, 2020 at 5:54 Comment(3)
Can this be made automatic when changing orientation in the right side bar?Grane
Currently, it is not possible.Clipper
Actually it works. https://mcmap.net/q/127481/-android-emulator-in-landscape-mode-screen-does-not-rotate answer works for me. Toggling this setting now automatically changes orientation without having to click an extra button in the emulatorGrane
B
1

I had to first press and hold rotate until I got into the menu. Then toggle Auto-rotate screen to true.

enter image description here enter image description here
Bypath answered 8/2, 2022 at 11:3 Comment(0)
P
1

on expo you must change app.json file

{
  "expo": {
   
    "orientation": "default",
    
  }
}

and turn on Auto-rotate from settings panel

Palpitant answered 17/12, 2022 at 16:18 Comment(1)
This is the solution that works in 2023!Tycoon
M
0

I had the same problem, I instantly fixed it by simply deleting the device from the AVD list and just creating a new one.

Matheny answered 9/8, 2013 at 11:37 Comment(0)
D
0

Only way to get this to work is to use FroYo API AVD

For anyone with this issue, this is how I set up old Froyo AVD to test this scenario:

My Manifest min version is already 8, which is Froyo

< uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />

You can see SDK_API_VERSION information here. http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

In the SDK manager Installed the needed version:

http://screencast.com/t/KKZokotI4T

Created a new AVD for the new version.

http://screencast.com/t/W8VN6fOWGW

Diverge answered 18/9, 2014 at 19:8 Comment(0)
B
0

On API level 25 (no skin) it worked after going into the setting, searching for "rotate" and toggling both related settings off and on again.

Baylor answered 29/2, 2020 at 14:13 Comment(0)
B
0

Pixel 2 - API 28 (Android 9)

I had to do this to fix it.

  • Open AVD Manager
  • Select Pixel 2 - API X
  • Edit
  • Show Advanced Settings
  • Untick "Enable keyboard Input"

Only this has worked for me.

Bubbly answered 12/7, 2020 at 18:58 Comment(0)
M
0

I am using API29 with Pixel-4 and Android 10.0 on ubuntu-20.04 with React-Native

I tried all the things mentioned here,

  • enabled auto-rotate on mobile.
  • unchecked Hardware keyboard present on AVD.

Unfortunately, it doesn't work for me.

Finally after Restarting my system and expo
$ expo start

# OR

$ npm start
Male answered 21/10, 2021 at 7:33 Comment(0)
M
0

When cloning a new virtual device, you have to enable the Accelerometer sensor. But sometimes the configurations are not written to the virtual device's config.ini file properly. Path: \Users\yourusername\.android\avd\virtualdevicename.avd

You have to check the properties and make sure these two properties are set to yes:

hw.accelerometer = yes
hw.sensors.orientation = yes

Open Android Virtual Device Manager Here you will find the device's config.ini file

Edit and save the config.ini file

Middelburg answered 16/2, 2022 at 17:8 Comment(0)
G
0

For Android Emulator 3.7 WVGA Nexus One I should have down graded the Android Version (it was 11 and i downloaded Pie (9) ), the rotation works now.

Generic answered 27/2, 2022 at 10:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.