Android Studio - How to add a Screen Size Definition - android-studio

I am building an Android Application using Android Studio.
I want my layout to be as precise as possible, however, it seems that the list of Android Virtual Devices where we can render the layout to is limited to Nexus Devices as shown in this screenshot below:
and the "Generic Phones and Tablets" do not have much screen size and resolution variety, so I decided to add my device definition as such:
However, it did not appear in the devices that Android Studio can render a layout to in the Design view of a layout.
Solved
After restarting Android Studio, the newly created AVD (Samsung Galaxy Note 1) now appeared in my list of devices that I can preview the rendering to when I view my layout.
I think all I had to do was to restart Android Studio for it to appear. It works now.

The solution to this, is to restart Android Studio. The new devices should appear at the bottom of the list.

For others having similar issues, you may want to check the API level of your AVDs vs the compileSDK of your project. I've found that, at least for Wear OS AVDs, my devices that target an earlier API don't show up. Once I made them the same as my compile SDK version, they showed up.

Related

Android Studio Emulator no more considering Swipes on Notebook Touchscreens as Input

I upgraded to Android Studio Bumblebee 2021.1.1 and realized that I cannot fully control the emulator with the touchscreen of my notebook anymore. Press events on the touchscreen (like mouse clicks) are still recognized correctly, but when I swipe nothing happens in the emulator.
Unfortunately, I did not note down the previous version of Android Studio that I had installed before, but with previous Android Studio versions I was always able to fully control the Android emulator via the touchscreen (as if I was actually testing my app on a real mobile phone).
My Google searches did not show any results related to this issue. Does anyone have an idea what the root cause could be and if it is possible to fix it?
Disabling launch in tool window in Settings::Tools::Emulator fixed it for me (requires emulator restart to take effect).
Credits to YuriBlaise on reddit

Showing All views in the top corner in genymotion Emulator in Android Studio

I have recently installed Android Studio with genymotion emulator based on a youtube tutorial. I'm designing a simple calculator with only one button and two Number(EditText) views . When designing, it is showing different views at different positions.But, when I run it, in the emulator, all the views are appearing in the top corner. How can I resolve this issue?
It sounds like you are using the ConstraintLayout from Android Studio, and you are missing the constraints for your layout.
To fix, go inside the Layout Editor, and click on the infer constraints button (https://developer.android.com/training/constraint-layout/index.html#use-autoconnect-and-infer-constraints) , recompile and deploy to your device and the buttons should be in the correct spot.
I'll also note, you should try the official Android Emulator: https://developer.android.com/studio/run/emulator.html

Android Emulator Screen Size Issue

My Android studio emulator screen is off the original positioning and I have tried resizing, reloading the emulator, and Android studio to no avail.
What is wrong with the emulator Display?
I have Alieanware 17 ( Dell Gaming Series ) when i updated my android studio version after week emulator screen shows small and not same size with skin fame size. i found in internet but no solutions after i searched many links Android Emulator Screen Size not the same as device frame see this links help me but in that when i choose software option in graphic setting in emulator device configuration. my emulator going slow. it also say that use this option when computer graphic issue.
here images shows before setting apply and after setting apply
Experienced the same problem as Solanki after updating from 3.1.2 to 3.1.3 (and Gradle update). Configuring the AVD graphics from/to "Automatic" had no effect.
Restarting and (installing Windows 10 updates - coincidence?) solved the problem and all running normally on start up.
you can just go to settings -> system -> scale and layout then change the size of text apps and other items to 125% restart android studio and run again the emulator.
good luck !
Update android studio if it's not up to date then go to settings and then in emulator tab tick on "Launch in a tool window". It will work
See Screenshot
Not sure if this helps, but I had this same problem (together with the side panel menu being overly large) after updating from Android Studio 2.3.0 to 2.3.1. After restarting my computer it went away...

I cant see the device on android studio

I need some help in displaying the actual device in Android Studio. At the moment I can only see the screen of the device but not the rest of the device.
I have attached an image so you can see what I mean.
It is not emulator it is design view for layout

Android Studio freezes when adding UI element

Running Android Studio 1.0.2 for Windows
Using a new Blank Activity or Blank Activity with Fragment project (bug happens with both). Haven't modified anything in the code yet. Using API 10: Android 2.3.3
Often immediately, sometimes shortly after I drag or edit my first/any UI element into activity_main.xml, Android Studio freezes and I have to close the process in task manager to get it to close.
I notice that in Task Manager the Android Studio Windows Launcher is taking about 25-30% of my CPU while its frozen.
What's going on here? Any ideas?
....
I may have found a solution for this.
I theorized that perhaps it was just the windows display that was frozen (the visual rendering of the Android Studio program itself) and guessed that perhaps this was using a DirectX device to do the rendering of the Android UI.
I happen to have another app running on my computer that uses a DirectX device for rendering (SimpleJungleTimer, an app I programmed with a DirectX overlay for League of Legends jungle timers). After I shut down this app Android Studio appears to be working properly (not freezing when working with the UI anymore)
Ultimately it sounds like this is a bug with Android Studio itself where they don't properly kill / reload the DirectX rendering device when it is in conflict with another app's active DirectX device (something that the android studio developers should probably fix), however until the android studio developers fix this you should be able to get around this bug by making sure any other applications that might use DirectX for rendering are shut down while coding in Android Studio so that their DirectX rendering devices don't conflict with Android Studio's DirectX device.

Resources