Incremental memory usage of Android Studio - java

I am using Android studio 3.1.3 (latest build as of writing this) with Gradle 3.1.3.
And don't know if it matters or not but I have recently upgraded to Ubuntu 18.04
Whenever I start Android studio, it starts with very small memory footprint. (single process named java takes around 1GB of RAM)
Now when I start build process, one more java process starts running taking around 500MB of RAM. Still it's no problem as I have 8GB of RAM.
After using studio for about hour or two (includes number of builds as I test on real device), suddenly computer freezes and there are three java process taking up almost 5GB of RAM (approx 2.3, 1.5 and 1.2 GB each). Those processes will not release memory even if studio is seating idle. I have to exit the studio and restart it to make it go away.
Here is the screenshot of my system monitor windows.
And below is the description of each process.
Is anyone else facing this issue? When I was in Ubuntu 16.04 and old android studio, this was not the problem. Does Ubuntu has to do anything with it?

I tried many things from many places from internet but nothing seemed to work.
So I downgraded back to Ubuntu 16.04 and issue is no more happening. Maybe some issue with my setup in 18.04 (which I hardly think might be the reason because I did re-setup from scratch twice and issue still persisted) or might be problem with 18.04 (not blaming!)
Thing is, I did not face problem of ram overflow only in Android studio but IntelliJ and TeamCity setup as well. Somehow many many instances of Java kept running in RAM by OS (sometimes over 10 instances of JVM, couple of which took 2 GB each even after build and everything was finished)
Hope it helps someone!

I always use Android studio on ubuntu 16.04 LTS version but i never faced this problem! If you have 8 GB of ram i think that you can update your Android Studio version and see if there is some improvement.
Anyway you can do something:
1 - try to use "invalidate cache and restart" function from file or pressing ctrl + shift + a or double pressing shift and writing "invalidate cache and restart".
2 - Go in ../yourAndroidStudioInstallationPath and try to delete the hidden folder named ".android".
3 - In your project under gradle script open gradle.properties and uncomment the line org.gradle.jvmargs=-Xmxx something
I have i5 3th u version, 8 GB ram and ubuntu 16.04 LTS and no problem with latest version of studio.

Related

Android Studio freezes when opening project on Ubuntu

Whenever I start Android Studio and click on "open existing project" the file explorer opens, but then the whole application immediately freezes.
Im using Android Studio 3.1.3 and Ubuntu 16.04.
What could be the reason for this error?
There could be several reasons for this behavior. The first that comes to my mind is whether or not your hardware/OS meets the recommended specs - you can find the recommended specs below, taken from Android Studio's site:
GNOME or KDE desktop - Tested on UbuntuĀ® 14.04 LTS, Trusty Tahr (64-bit distribution capable of running 32-bit applications)
64-bit distribution capable of running 32-bit applications
GNU C Library (glibc) 2.19 or later
3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
2 GB of available disk space minimum,
4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
1280 x 800 minimum screen resolution
You could determine whether or not memory/CPU usage is the problem by issuing the following command when Android Studio is running:
-$top
-[SHIFT+M] (key combination that sorts processes by highest memory usage)
-[SHIFT+P] (key combination that sorts processes by highest CPU usage)
Bear in mind that the most likely memory offender of Android Studio will be Java and that's what you'll see in the top command output. If your memory usage is high, it's possible that your OS will start to use swap space which could significantly slow things down. To see how much swap memory is being used, issue the following command:
$free -h
This command will show you, at the time the command is issued, how much RAM and swap memory is being used in a human-readable format.
Another possibility that I have not experienced personally but have seen others have issues with is connected USB devices. Perhaps you have your phone connected - if this is the case try unplugging your USB connected device and then issue the following commands from a terminal (within the android_sdk/platform-tools directory):
$./adb kill-server
$./adb start-server
If you're not sure where the platform-tools directory is located, you can issue the following command:
$locate platform-tools
If Android Studio seems to start up/run without issue when the device is not connected, try reconnecting the USB device and see if the problem recurs.
It's also possible that what you're seeing is keyboard-related - i.e. the application stops responding to keyboard-input - this may be related to a known issue with the iBus Daemon - possible workarounds can be found at the following link:
http://tools.android.com/knownissues/ibus
If your problem is determined to be resource usage - it may be necessary to add more memory. If that is not the issue, it might be worth trying to completely reinstall Android Studio.
In case of misconfiguration, closing Android Studio and deleting .AndroidStudio3.1 configuration folder may help.
Find your configuration files | Android Developers
In some similar scenarios of misconfiguration deleting .idea folder might help.
Delete from command line the .android folder sudo rm -r /pathOfAndroidRootFolder/.android.
Try invalidate caches and restart option :
File -> Invalidate caches and restart
You can try deleting .AndroidStudio folder and check, because some java update might be needed for Android 3.1.3

How to run Android Studio on Win XP? [duplicate]

I have been trying to download Android Studio for the past week or so and haven't been able to. I'm still running windows XP on a Dell d430 (If it helps). The error happened when it was extracting a file. If you could provide a link which can download android studio for Windows XP on a Dell d430, please do. Thank you for your time (by the way I know that this question doesn't have much to do with programming).
Check this page
Wiki
Version 1.X only supported for Windows XP
The self-extraction that the installation binary performs has definitely nothing to do with what version of Studio you try to install or whether it supports XP or not, the installation shall start and tell you if there's a problem.
Actually, you can run Android Studio fine on Windows XP, I do it on a Dell Inspiron 9200 (Intel Pentium 1.7GHz 2GB RAM). I even installed the latest version 2.3.2 and Java SDK 8(which is required: make sure it's not just JRE 8 but both). Java SDK 8 complains about XP being old but installs fine. There's a snag in Studio tools with an XP dll but that can be fixed, read on.
The downloading doesn't involve extracting as your question implies, if it does you haven't got the right download. When downloading is done and the installation is started, that's when the extraction begins.
If you didn't download from developer.android.com/studio/ it might contain malware. You could scan it but being a huge file(approx. 2GB) you have to download a scanner, e.g https://www.bitdefender.com/support/how-to-install-bitdefender-on-windows-xp-and-windows-vista-1453.html
For Windows versions newer than XP / Vista refer to www.bitdefender.com/toolbox/freeapps/desktop/
After the download is done (and verified if needed), your problem with the installation program might be one or more of, but not limited to:
The file you downloaded is corrupt. Try downloading another copy.
Corruption on your hard drive, however less likely if the same file fails to extract again and again.
Your Memory or CPU is failing. Very unlikely if the same file fails even twice.
Corruption in the current directory data block or a problem with the directory path. Try creating a folder at the root with no spaces in its name ( e.g. C:\Download ), move the installation file to it and run it from there.
About support/compatibility: it's not unpermitted trying to install and run, and I for one am all for it. But if it's not supported and you run into problems, another way to go rather then upgrading your system is to downgrade your software. Here you have suggestions, but take care scanning them for malware. For smaller files(current max 128MB) you can upload to Google owned www.virustotal.com/
How to install an older version of Android Studio
Finally, the dll problem in Android Studio 2.3.2 is with the adb program requiring a newer version of WS2_32.dll (it's technical: never mind). A work around is to download an older version of adb:
forum.xda-developers.com/nexus-5x/general/psa-fix-adb-doesnt-winxp-t3403955
Or, as the suggestion here says: if you're feeling adventurous, you can always grab the new WS2_32.dll, then scan it by uploading to www.virustotal.com/, and register it with the command regsvr32 WS2_32.dll (google regsvr32 for more info on that).
coderanch.com/t/667002/Android-ADB-find-entry-point
/z
Most likely, Windows XP is not supported. You should find a way to update your operating system. Consider installing Linux on your old machine. Recent distributions will work albeit very slowly.

Speed up eclipse juno on windows

I have 4 GB of ram and a core 2 duo processor . I am running eclipse for android on it and its running slow. There are no other programs running on it and its only using 40% of the CPU.
I thought that if i could dedicate a CPU only to this program it might run faster. Any idea on how it can be achieved. Any help on this matter would be appreciated.
This problem also made me think on how a multi core processor runs and why is it better then other single core systems any verified literature on this available on web.
These are some general methods to speed up your eclipse,
1.Make sure you have latest JDK installed and eclipse has reference to it.
2.You are currently using Juno(4.2) , try to install latest version like Mars or Luna(4.4) . It is preferable to use Android Studio because it is official IDE for Android development.
3.As you have 4GB of RAM ,try to modify eclipse.ini file
-Xms128m
-Xmx350m
Replace -Xmx350m with -Xmx4G so that it gets 4 GB of RAM instead of 350MB .
There is noting magical to seed up your PC or eclipse. It seems that your CPU is not faster enough as your desire. And obviously eclipse is not very lightweight too. So there is no solution actually. And don't be frustrate by thinking that your PC or eclipse is doing something unusual. Its normal.

HAXM is installed but emulator not running

I recently upgraded my CPU from core2duo E4600 to E6550. E6550 is supports virtualization. Then i install HAXM intel hardware acceleration manager.Installation was successful. People on youtube and many other sites says it fast the emulator but in my case my emulator is not even starting.. I have this configuration of device
AVD doesn't even show that "A valid android virtual device" in the bottom... it shows two options only
Please suggest me... how to run my emulator.. i have searched a lot.
You need to use an x86 system image like this one:
You can download x86 images in the SDK manager (the one shown contains Google Play which is a bonus if you need to have it on your emulator).
The "errors" at the bottom of your window aren't errors. What you're seeing is a poorly designed key for what any icons that appear next to your devices may mean.
Do you perhaps need to create, not edit, an AVD?
Try increasing the memory used by HAXM.
You can find the guidelines in Configuring VM Acceleration on Windows section of this page: http://developer.android.com/tools/devices/emulator.html
Check the version of andoid studio you have installed is it lower than what the render supports?
Because I also had the same issue and what solved it was just uninstalling the android studio I initally installed and installing the one that was compatible version wise.
My Old Installation that didn't work despite all my efforts, thinking my installed haxm was faulty or not working was
android-studio-bundle-141.2456560-windows
So I uninstalled the above and installed the one below before it started working.
android-studio-bundle-141.2117773-windows
Not really sure why that solved it even though the one i uninstalled seems to be more recent than that of the previous one. But that solved it and so it seems there are version compatibility issues.
Hope that helps.
Download the HAXM installer on the intel website and install
https://github.com/intel/haxm/releases
Windows
Run the haxm-7.6.6-setup.exe to install HAXM
Mac OS
I am not quite sure.

Eclipse freezes Ubuntu, hard reboot required

I'm on a team of 6 developers and we are all using Eclipse Indigo on Ubuntu 11.04. At least once a day, if Eclipse is running, each of us experiences a total system lock-up. The only cure is a hard reboot of the PC. Some of us have had it more than ten times in one day. This does not happen if Eclipse is not running, so I can confidently say that Eclipse is the problem.
I have tried increasing the memory available to Eclipse by going into the ecplise.ini and increasing the Permsize, MaxPermSize, Xms, and Xmx. This has made no difference and everyone's PC is still locking up.
Has anyone experienced this before? I could understand maybe on one PC, but it happens on every single PC!
Java version: java-6-sun-1.6.026 JDK version
Ecplise version: Indigo SR1 BuildID 20110916-0149
Ubuntu version: 11.04 64-bit
EDIT: Ctrl-Alt-FnX keys do not work once the PC has locked up.
EDIT: I've revisited the eclipse.ini settings and increase the memory some more. So far I haven't had a crash yet. I will use the other developers as guinea pigs, but I'm hopeful that these settings will stop the crashing.
-XX:PermSize=256m
-XX:MaxPermSize=512m
-Xms1024m
-Xmx2048m
This is not to resolve Eclipse problem... which might be happening because of some display issues I suspect.
Instead of hard reboot you can press keystrokes Ctrl+Alt+F1 together to reach console and there you can login to a text based terminal and kill the Eclipse process.
more a comment than an answer, but I cant add you a comment yet.
I'm kinda using the same setup: Ubuntu 11.04 64bit with Eclipse Indigo SR1 RC3 64-bit (buildid 20110909, didnt had time or need to update to a newer release yet, but RC3 is stable for me). Make sure, you have installed the 64-bit version of Eclipse.
OpenJDK in combination with Eclipse didnt went well for me, so I changed to java-sun jdk 1.6/7. Make sure Eclipse is not referencing to the OpenJDK installation instead of java-sun jdk.
I had some issues with Eclipse Indigo (pre SR1) freezing in combination with SVN Subversive/m2eclipse plugins. For me it got better with the SR1 (RC3), but still not perfect (a freeze now and then). A while later Subversive SVN had an update, and now it's stable again. In short: make sure, you have installed the newest plugin versions (use eclipse update sites, no local copies). Older versions might lead to the same problems I experienced.
What other plugins are you using, can you verify if your Eclipse crashes without any plugins installed?
Two other issues I'm aware of: with Ubuntu Karmic Koala (9.10) rendering UI elements was broken/lead to crashes as well (GTK_NATIVE_WINDOWS). Later Eclipse had problems with the native scrollbars (think it was with Ubuntu 10.10 or 11.04). I'm pretty sure, problem 1 aint an issue anymore with Eclipse Indigo + 11.04. Problem 2 I'm not sure if it was 10.10 or 11.04. But I still start my eclipse with the following script.sh and it works for me, you could give it a shot as well:
#!/bin/bash
export LIBOVERLAY_SCROLLBAR=0
export GDK_NATIVE_WINDOWS=false
exec $(dirname $0)/eclipse "$#"
Try upgrading the kernel to the latest version. I think this lock up is caused by the kernel bug detailed on this page https://bugs.launchpad.net/ubuntu/+source/linux/+bug/924905
While you wait for better answers, I would definitely try a virtual machine like Virtual Box to:
Try to see if I can replicate the problem in a Virtual environment, which is similar to your actual environment. This way you can see if the problem the combination of the versions of software that you're using or your physical hardware.
Run Eclipse through the VM. It may not crash and will prevent you from having to do a full re-boot of the system, until you determine what the actual problem is.
I have a similar problem. From time to time it happens that the complete X11 desktop freezes. I can still move the mouse but clicks on elements have no effect.
In this situation I switch to the text console and kill eclipse. After I did that, everything works again.
I am using a laptop with an Intel graphics chipset. So I tend to blame it on the the graphics driver.
I have other computers with different graphics hardware where I haven't noticed the problem, but I don't use eclipse that often on them. On all I am using Ubuntu 11.10 64bit with gnome or unity desktop.
I have the same issues. It is very inconvenient. I have just confirmed that killing eclipse fixes the issue for me.
However, I have found something strange in that I can still click on the stupid overlay scrollbars. It's like they have the focus of the entire system.
What seems to have fixed the issue to me was to install the gnome shell and start using gnome 3, then turn off the overlay scrollbars in the startup scripts for X. I installed gnome 3 for a separate reason and disabled the scrollbars because I find them annoying, but I do find that this has solved the problem for me. You may be able to get away with just disabling the scrollbars, information for which is readily available on google.

Categories

Resources