To rotate the simulator, run the following command. The final numbers range from 0 to 3, representing four different screen directions. (API 28 test valid)

adb shell settings put system user_rotation 3
Copy the code

If that doesn’t work, try adb shell Settings put System Accelerometer_rotation 0 to turn off automatic rotation.

Blah, blah, blah

The new android emulator seems to have some bugs, clicking on the rotate screen button either doesn’t work (latest version) or the phone turns but the screen doesn’t change. That is, it can’t trigger the screen turn effect.

I did a search on how to rotate the emulator. The results were (fn) + CTRL + F12 [MacOs] or something like that. But these shortcuts don’t work.

Rotate Left (⌘←) is prompted when the mouse moves over the screen rotation button, but only works on certain emulators (API 18?). , and this way will also have the above does not turn the screen problem.

How to solve this problem?

There are two ways to do this. One is to use API 21, the Android 5.0 mirror, which supports screen rotation. However, this approach requires a dedicated image and does not use other versions of the emulator. So another way is to use ADB to modify system parameters? The method is right at the top.

Reference stackoverflow.com/questions/2…