Android Studio freezes when adding UI element - android-studio

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.

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

Android Studio stuck patching a system image

I just clicked the update button on Android Studio. It downloaded packages and it got stuck at the point shown in the image.
I had the very same issue on MacOS High Sierra while updating Android Wear x86 Oreo emulator image.
Since the updating window blocked me from using Android Studio, I got out of patience and hit the cancel button. The "stopping" operation of this apparently non cancellable operation continued for minutes in the background (showing at the bottom of the IDE), and then finally finished.
It seems the operation was not cancellable since there was no update to do aftewards, so if the emulator image patching operation is taking time, "cancelling" it to get use of your IDE back is the way to go as of Android Studio 3.1 Canary 9
I have similar issue just now on Windows and Mac OS, and my solution is by removing manually, related system image that required update, from Tools menu => SDK Manager => SDK Platforms. Then re-install this system image after that from the same menu.
check your internet connection if it not works then force quit it and clear cache and restart android studio then update it again

Android Emulator won't start after Android Studio 2.0 upgrade

I recently upgraded Android Studio to 2.0 (Windows) which broke the emulator.
The symptom is that the emulator starts a (single thread) process that takes about 100% of its CPU. Nothing shows on the screen.
Of course, this worked like a charm before the update.
Few things I tried:
Used an AVD created before and after the update
Increased AVD memory to 1G
Delete / Install Android Studio
Used different CPU Architecture (Arm & x86)
Used different versions of API (21 & 23)
I had the same problem I had to reinstall android studio all over again, After that open your SDK monitor press on launch stand alone SDK manager, There scroll down and check if the emulator is installed properly if not install it.
I hope this answer helped you since that's what I did and it works.
A temporary solution:
Go into the AVD Manager, select the Virtual device, and click "Edit"
Find "Emulated Performance" -> Graphics, and switch that from auto (or hardware) to Software.
It won't have quite the performance, but this worked for me. Seems to be that Android Studio 2.0 doesn't play well with certain graphics cards or something.

Device doesn't render in Design tab, Android Studio 1.4

I have a problem with my Android Studio I just updated.
There is no device renders in the design tab, even if I create just a blank aka 'hello wolrd' activity as you can see on this screenshot.
I am absolutely sure I have no running background tasks, my Gradle build is finished. I tried to clean up and then to rebuild project, nothing changes. Am I missing anything?
P.S. I had no problems rendering device on Android Studio 1.3.
Ok, I got it.
I had to update my SDK to 23st version and choose this version while rendering device.
Very simple and truth be told obvious way.

Android Studio - How to add a Screen Size Definition

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.

Resources