Android Studio Flutter Project Error: Out of Memory - android-studio

I run any flutter project on Android Studio and it throws an Out Of Memory Error.
The message shown in the console looks something like this:
e:\b\build\slave\windows_engine\build\src\third_party\dart\runtime\vm\scavenger.cc: 411: error: Out of memory.
Dumping native stack trace for thread 2750
[0x00007ff676324b63] Dart_IsPrecompiledRuntime
[0x00007ff676324b63] Dart_IsPrecompiledRuntime
-- End of DumpStackTrace

A few things you can try:
Run flutter clean and flutter upgrade in the terminal
Uninstall and reinstall the app
(Android Studio) File -> Invalidate Caches and Restart
Restart your computer

Considering the lack of information you've provided, I can only consider the fact that the good practice for creating mobile applications, judging by the fact that a mobile device's memory is usually lower( and the memory allocation is much slower ), when compared to a computer's memory and memory allocation speed, is to store your information in a database and access the needed information using queries.
That could actually fix your issue. If not, please provide more information.

shutdown computer completely, don't to hibernate.
That works for me.
You can shutdown computer completely using this command
shutdown /s /f /t 0

I had a similar issue. I restarted my PC and it worked fine.

Just close emulator by task manager. emulator must fully restart

Related

BlueScreen after Run emulator android studio

When im run android studio, or run emulator for android studio with manually or with cmd, always get bluescreen.
it say "your pc ran into problem and needs to restart. we're just collecting some error info, and then we'll restart for you"
Stop code: IRQL Not Less or Equal
how can i fix it ?
im trying download another emulator and following tutorial on youtube, but it didn't work
It depends on various factor,
I happened to get this issue because of my old PC with Lesser RAM size(4GB) and to rectify it, I connected my Android phone to PC for debugging/running apps from Android Studio.
You need to enable USB Debugging in your phone for that purpose.
NOTE:
You can view this blog post I made, which addresses the same issue.
https://whysurfswim.com/2015/07/11/sick-of-your-avd-theres-a-alternate-for-it/
I had almost same problem. When I tried to install my app in emulator(Ram 8gb), my emulator crashes but kept running in background. As a result, I was unable to shut down my pc and have to disconnect power for shutting down.
use your phone for debugging your app. you can connect your phone using wifi. link here
Sometimes it happens beacause of outdated drivers, try updating your drivers to latest version, and update the windows 10 to latest version. Also try by deleteing your current emulator device and create new device by enabling software renderer. For lower end pcs like yours I would recommend to use real device instead of emulators ans use ssds for better performances.

SO_REUSEPORT unavailable on compiling system to run emulator for android on Ubuntu

I was trying to install SDK and Emulator without the Andriod studio on Ubuntu 20.04.
But got stuck at this error.
E0520 11:06:29.866803544 5261 socket_utils_common_posix.cc:201] check for SO_REUSEPORT: {"created":"#1589952989.866791260","description":"SO_REUSEPORT unavailable on compiling system","file":"/mnt/tmpfs/src/android/emu-master-dev/external/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc","file_line":169}
checkValid: hw configs not eq
I got the solution from this article:
So in order to fix this, I just disabled the Camera by switching the option from Emulated to None and that was all.
Don't ask why this works, but it seemed to solve it for me.
Install Android SDK Platform tools. if already exist uninstall and install Android SDK Platform tool in ubuntu 20.04
Seems a GPU issue, try :
sudo ubuntu-drivers autoinstall
Or (or both) change graphic emulated performance to software if your emulated device allow it.
Had same issue with linux mint android studio ..
Hope it will help.
Though not directly affected by the error you described, when stuck at this point (namely, when supposed to be connecting back to the ADB server, but can't), this can be a result of a corrupted quick-boot snapshot.
What worked for me is to hard-delete the existing quick-boot snapshot, and have the emulator regenerate it on the next run.
To delete the snapshots:
rm -fr ~/.android/avd/<AVD name>/snapshots/default_boot
To regenerate the next snapshot, rerun the emulator as you normally would, then kill it after if full loads. But first, make sure that it is configured for saving a quick-boot snapshot on exit:
Edit quickbootChoice.ini, for example:
vi ~/.android/avd/<AVD name>/quickbootChoice.ini
The only line there should be:
saveOnExit = true
If you wish to see whether any of this is likely to help you before making any changes, run the emulator with the -no-snapshot argument applied, beforehand. For example:
$ANDROID_SDK_ROOT/emulator/emulator -no-snapshot #Pixel_API_29 &
(Or find a way to do this through Android Studio)
A note regarding other answers here that advised configuring the camera differently (which seems unrelated): It is very likely that changing the camera setting, for the Emulator, is considered a configuration change - which ends up in forcing a cold-boot (i.e. skipping usage of the quick-boot snapshot), which can explain why it works (but with no voodoo involved).

AVD Emulator stuck on loading screen in Android Studio

I decided to try Android Studio 2.0 having used Eclipse in the past but I'm having considerable difficulty getting the AVD to load correctly. I've done quite a bit of googling and research into the problem, both here on SO and Google.So far nothing has worked.
The emulator simply hangs on the android load-up screen ever time I try to run it. I've seen it advised to use Genymotion but I would first prefer to resolve the issue natively in Android Studio to feel confident going forward using the IDE for building projects.
Here's what I've tried:
Complete reinstall of Android, SDK and SDK Tools
Install and configure of Intel x86 accelerator
Lowered the RAM amount to 512 in AVD settings
Multiple attempts at deleting and recreating AVD's
Tried creating different AVD phone models(Nexus One,Nexus 5x etc.)
Resetting ADB in AVD Monitor Tool
Starting ADB server from terminal
Restarting Android Studio multiple times after changes
Running SDK/SDK Tools updates several times
Made sure the SDK path is correct
These are the majority of the "solutions" I found either on other similar SO questions or by googling none of which has resolved the problem.
When I run the emulator currently it displays the following in the run window:
/Users/<username>/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_API_23
Warning: requested ram_size 1024M too big, reduced to 512M
emulator: WARNING: Increasing RAM size to 1024MB
emulator: WARNING: VM heap size set below hardware specified minimum of 228MB
emulator: WARNING: Setting VM heap size to 256MB
Hax is enabled
Hax ram_size 0x20000000
HAX is working and emulator runs in fast virt mode.
console on port 5554, ADB on port 5555
The emulator shows up fine in the Android AVD Monitor devices pane and even appears to go through the entire booting process on the emulator screen itself but never gets to the Android home screen.
Also, Logcat seems to be looping continuously through dozens of errors and warnings, which don't offer any clear indication of what the issue might be or direction of how to resolve it.
I feel like I've exhausted every idea and not sure how to move forward.Just for the record, I am running El Capitan 10.9.2 with a 2.4gh Intel Core 2 Duo and 4gb ram.It's not the fastest machine for sure but should be capable of running Android Studio and the emulator.
Any help or guidance resolving this problem is gratefully appreciated!
For me this worked: in AVD(Tools->AVD) click on the small arrow for desired emulator then click on "Wipe data".
After that, it successfully started - passed the android logo screen - although a bit slowly.
You have two thing:
You should Increase your ADB emulator Heap to the minimum required.
in your case: 512M
into your AVD Manager:
Click Edit on your Emulator
"Show Advanced Settings" at the bottom
Go to: "Memory and Storage"
Edit the VM heap value to 512 MB
Finished
Image:
You can Wipe data to your Emulator. here is an exemple website
At one point my laptop hit a kernel panic and restarted while running an active AVD emulator session. When attempting to restart the emulator, the emulated device (Pixel 3) stayed stuck on the startup splash logo screen.
Fix steps:
Stop hung emulator session.
rm ~/.android/avd/name_of_emulated_device.avd/*.lock
rm ~/.android/avd/name_of_emulated_device.avd/*.qcow2
Restarting the emulated AVD should now be successful.
Windows equivalent for ~/.android should be C:\Users\.android, but I can't confirm this myself.
Note: You will likely lose any additionally installed apps and current work that was on the AVD.
Unfortunately, increasing the heap size didn't help in my case. The virtual device was actually running fine before with the previous amount of heap.
What I eventually ended up doing was just creating a new virtual device through the AVD manager leaving most of the fields the default value. The new device ran fine and booted up as expected and was able to run my app. It's possible something in my first virtual device became corrupted.
I had the same problem. I'm running El Capitan 10.11.5 with a 2.0GHz Intel Core 2 Duo and 8GB RAM, Android Studio 1.5.1.
After upgrading to Intel x86 Emulator Accelerator (HAXM Installer), rev 6.1.1 and deleting my API 14 SDK and related files, the newly installed API 23's Google APIs Intel x86 Atom System Image would not get past the Android logo screen.
After much trial & error, the Intel x86 Atom System Image (not Google APIs Intel x86 Atom System Image) for API 15 finally loaded the home screen on the emulator after ~ 8 min and one android system crash.
Will try the Intel x86 Atom System Image for API 23 later. Hope that helps.
I had the same problem and none of the steps listed here helped me, either.
But since the solution that worked for me was not mentioned here yet, I thought it might help you or one of the others finding this thread:
What did work for me was disabling certain settings in my Avast Antivirus as proposed by the Android studio troubleshooting page here.
My version of Avast did not have the setting "Use nested virtualization when available", however just turning off "Enable Hardware assisted virtualization" (note: restart is required for it to take effect) solved the problem just fine.
So if you are using Avast or another Antivirus which manipulates virtualization, be sure to look through the correspondent settings.
I had experienced same problem, What I did was, I clicked on the drop down in the actions column, then clicked on wipe Data, and that resolved it for me on ubuntu 20.04
I had this problem and running as admin fixed this (drove me crazy).
Hope this works for you too tried some many fixes.
What worked for me?
Create new project with same configs.
And start your old emulators in it.
What did not work?
Wiping data.
Increasing Heap size.
Creating new virtual device.
I also had the same problem with my AVD. After lots of trial and error I arrived at a solution for my problem. the problem was with the Heap size and the RAM size.
Initially the default heap size was 128 MB and RAM was 1563 , I just changed the heap size to 512 MB and reduced the RAM size( high RAM was making my pc run slow) also I enabled hardware acceleration. And Yipeee, it worked.
It's very easy to fix all you need to do is go in AVD Manager click on the small arrow on most right side of the screen beside the edit icon. Click that small arrow and select wipe data.
Now when you'll start your AVD it will restart and work properly.

My app runs very slow after using debugging tools

I was trying to debug a heap corruption issue in our app, and used appverifier, gflags and _CrtSetDbgFlag to try and track it down. now i've cleared the gflags, removed our app from app verifier and removed _CrtSetDbgFlag, yet on my computer now the app is horrendously slow (over 15 minutes just to start it up).
It doesn't matter how i run the app, even with visual studio closed and double clicking a release executable i get the same slow behavior.
Can anyone point me to what i may have screwed up on my machine to have this issue?
Thanks
I've solved the problem for myself by using system restore to go back to before i used gflags. I notice now that gflags does come with the warning:
Note Incorrect use of this tool can degrade system performance or prevent Windows from starting, requiring you to reinstall Windows.
So i probably should have been more careful.
If anyone has a better way to fix this than system restore, like a list of the registry entries that gflags changes and what they should be by default, that would still be very helpful.

Android emulator constantly rebooting on Ubuntu Maverick

and thank you for your time.
I am using Titanium Appcelerator to write an app for Android, and as compared to Windows, where the emulator was quite stable, in Linux I get the following symptoms:
emulator restart with no reason, sometimes after a runtime error, sometimes right after launching my app, and sometimes just right after booting completely after being launched
emulator informs that "process $1 is not responding", where $1 is generally the system process, but sometimes may be acore, or the calendar. This may happen while installing my app on the emulator, right after loading it, or right after unlocking the screen.
As it is easy to imagine, testing code like this can be quite difficult, so I was wondering, has anyone else stumbled upon this problem, and/or know how it could be solved?
Thank you very much in advance, and pls let me know of any info I should provide.
Leo
You should verify that the emulator is working fine without Appcelerator first. Definitely update to the latest SDK (r8) and create a new emulator AVD and see if the problem is there without Appcelerator.
I think I found a solution, but I don't claim it is universally valid: I just erased the virtual device created under Titanium, changed the project file for it to use SDK 1.4.2, and had it launched again under 1.4.2. It certainly didn't build my app, but at least it created a new virtual device, which I use now to build against 1.5.0, working like a charm so far.
Thanks again Manfred for pointing me in the right direction!

Resources