android studio hang frequently on ubuntu - android

I have switched to ubuntu 14.04 from windows7 and now my android studio is hanging too much and my system configuration is as follow :
Ram : 6 GB
Processor : Dual core
Main problem is while debugging the application and for that i am using device not an emulator and i have also seen that my sdk size is 60 GB on ubuntu but on window it was about 15-18 Gb and I don't understand why it is taking this much space?
So if someone has idea why this problem is coming,
Please Help me with it.
Thanks in advance

The hanging problem can be a result of lot of different things:
-It might be because your Android Studio is using too much of RAM.
You can check this by following command:
$top -o %MEM
this would result in such an output:
the output of top command
the "Java" there in the first line, in the linked image is the Android Studio and in my case its using 47.5% of RAM.
As I have low RAM, the OS starts using SWAP memory which would make the application respond slower. Usage of swap memory can checked by using command
$vmstat 1
So, there is no way you can bring that down. You can only close other applications so as to provide the required RAM.
I have 2Gigs of RAM and therefore I login into OpenBox and then start Android Studio, this works for me quite well
While the size of SDK must not be a problem.
The size of SDK depends upon the tools and the API related SDKs that you have downloaded.
You can open up your SDK manager and delete some packages if you want but that wont make Android Studio run faster.
-The other reason can be the iBus-daemon and that is a known issue. The workarounds can be found here
http://tools.android.com/knownissues/ibus

Related

android studio on a machine with less than 2GB RAM

My laptop is a bit old...only 1.8GB RAM....Android installs good but when I load a project it freezes with the gradle stuff.
I tried android studion on Windows XP, Ubuntu, tiny core, puppy and now lastly BBQLinux. Each of them have same issue freezing at the gradle stuff...except windows xp which says something like '%1 is not a windows application'!
My question is that can I use swap as RAM, how to enable swap in BBQLinux? Will it make a difference? or is there another alternative?
I don't want to upgrade laptop as I just want to build a simple app for my phone.
Thanks.
Android studio takes more memory as well as internet because Android studio is capable of handling all the dependencies automatically (using gradle just like maven in java EE). All tools that does debugging on the real time occupied memory and process cycles. Also the emulator UI quality improved in Android Studio emulator in comparison to Eclipse. So threads and processes takes up huge amount of memory space.
If you still want to lessen the memory issue follow this link hope that will help you

Starting AVD Emulator always gives "Android Emulator Closed unexpectedly"

My sincere thanks for your reading this.
I have just installed Android Studio and am attempting to run the default Hello World! script that is present when you create a new project.
Every time I try to run the the program in an Android Emulator my Emulator crashes and I get the error "Android Emulator Closed Unexpectedly" Every. Single. Time.
I have the Intel x86 Emulator Accelerator (HAXM installer) installed as suggested:
I try to run a Nexus 4 emulator with 512 mb of Ram and it never works:
When I run this I get:
During this, my system physical memory peaks at 80% but never goes to 100 (which I would expect if it were crashing).
I have searched similar questions including
Android emulator crashing on Windows 7 64 Bit Android 4.0 emulator always has a crashing Launcher? Android studio emulator fails to start with memory limit related error message and they say to lower the memory size (which is what I am trying to do). Unfortunately this isn't working
Any idea how I can solve this issue?
My computer specs are as follows:
64 Bit Windows
6gb Ram
Intel Core i3
I downloaded and installed all correct versions as instructed here: https://developer.android.com/studio/install.html
In my case, this issue took the whole weekend to solve.
All options I tried, until:
Android Development Studio prompted me to update the Android Emulator Version to 25.3.1 (no idea what it was on before as I didn't check this before). This was a download of ~170mb.
Once I downloaded and installed the update, the emulator now seems to run OK on low memory settings - settings in keeping with the answer to this question here: Android emulator generates a very annoying error
I am now running with settings:
RAM memory to 5012
Virtual heap 32
Internal storage 200 mb
External storage 64 mb
So basically, it was a complete fluke that this worked.
To anyone that gets this error after rooting the android image, (if using snapshots). You need to start the virtual device with the -writable-system parameter like when you rooted the device, excerpt from docs.
Snapshots
...Starting a virtual device by loading a snapshot is much like waking a physical from a sleep state, as opposed to booting it from a powered-off state.
I was also having the same problem, Every time I was starting Emulator, it was closing unexpectedly. then I tried to change the Emulator Performance in settings of AVD Managers; In Software it's not working but in Hardware it was showing blank black screen.
Then I realized, there might be some issue with Graphics Card(mine NVIDIA GeForce 940MX), It was showing this error
After Updating/Restarting the problem was not resolving, then I Disabled then Enabled the Graphics Card Driver in the Device Manager and It worked!!😊
LONG STORY SHORT: Check, the problem might be due to your Graphics Card!😐
in my case, i attempted using gennymotion [ you may install it asking google genymotion . com] this could serve as alternative.
if gennymotion after installation returns this error message "the version of openGl supported by your graphics card is too old:Genymotion requires at least openGl 2.0 support. "
then know our challenge is arising from not having required graphics driver
either you checkout this link [https://buffered.com/support/solve-opengl-error/] on how to resolve it in steps.
or you download the graphics drivers using the links below
Here are the links to the 4 most prominent graphics card manufacturers in the world:
Intel: http://www.intel.com/content/www/us/en/support/detect.html
restart your systems after installation of the appropriate graphics driver and continue your project .

Android Emulator Crash in Mac Os

I am facing new issue after updating the Android SDK.
I am clicking on the Run in the Android Studio.
1) It opens emulator but during loading the emulator is getting crashing..
Crash Log along with image is attaching here..
Did you try to address the warning message? I suppose you don't have enough RAM left after allocating ~3GB to the virtual device . Especially if you are using a Mac with less than 8GB RAM that's an overkill (I haven't tried if it's at all possible to allocate more than 2GB even if you had enough RAM). Try to reduce the emulator RAM to 2GB and see if that fixes the problem.
This existing stackoverflow question link should help
avd device setup choose emulator device with least resolution, it uses less space on disk
Tip: How to make Android Emulators fast?
I would suggest having an alternative emulator always..
you can't depend on one, get Genymotion emulator
install genymotion plugin for Andriod Studio/eclipse from plugins
You also need genymotion installed on your system, download genymotion

Android Studio is incredibly slow and laggy

Android Studio is painfully slow. It's not just the Gradle build times (which I have seen reach 40+ minutes before I cancelled), it's the whole IDE and my whole computer slows down when AS is open. When I click anywhere in AS, whether it's inside the code or menu items or anything else, it takes seconds to respond.
I uninstalled Eclipse because it was too buggy. AS isn't as buggy but it's way too slow.
Here is what I have tried so far:
Made sure I'm not in presentation mode
Tried both having Compile independent modules in parallel ticked and unticked - slow on both
Changed vmoptions to have -Xmx2048m -XX:MaxPermSize=1024
Ticked Make project automatically
Ticked Use in-process building
Ticked Configure on demand
Ticked Offline work in Gradle
Added --offline in Command-line Options
Added Thumbs.db in "Ignore files and folders" (Editor -> File Types)
Added org.gradle.jvmargs=-Xmx2048m, org.gradle.daemon=true and org.gradle.parallel=true to gradle.properties
Made sure I'm adding only the google play services libraries that I need
None of these solutions helped so how do I fix this? Please don't link a post if it just has things I've tried above.
Like karun already said, an i3 is definitely too low powered to run Android Studio. I'd recommend at least an i7 2ghz or faster, paired with a pure ssd storage (spinning disks are horribly slow in comparison). 8gb RAM is the absolute minimum, 16gb or even more would be better. Android Studio is a heavy-wight IDE and it uses a lot of memory, especially when running gradle in parallel mode.
With such a setup, it still doesn't feel what I would call "fast", but it's OK, regarding all the tasks going on at the same time.
If you want to keep the i3, then the best you can do is to equip it with as much RAM as possible. Also replace your disc (if it's a spinning one) by a fast ssd drive.
This is not a solution, but i think i3 processors are not much powerful to run Android studio smoothly. I had i5 processor and 4GB ram, and I couldn't run chrome and android studio simultaneously with ease but now I've upgraded my ram to 8GB, which helps a lot, still the laptop freezes a bit when the gradle files are being built but other times every thing runs smoothly.
Did you also check -Xms2048m in vmOptions?
This affects the initial ram your android studio takes from the system when loading. The other setting you have (-Xmx2048m) affects the maximum ram android studio can get.
Also setting (-XX:ReservedCodeCacheSize=1024m) helps.
I have a few things for you to try out:
Try an older version of android studio.(If the only thing you want is performance).
Try using a physical device instead of a virtual machine.
Try using a lighter operating system (like lubuntu 18.04). Windows on my computer takes 1 gb when idle while lubuntu takes 1.2 gb when android studio is running
If none of the above work you should consider upgrading your computer.
I personally use a core 2 duo E8400(2 cores,2.83 ghz) with Lubuntu 18.04 and 2 gb ram and android studio 2.3.2 (my computer is so old that is why :)) and it runs flawlessly but you have a core i3 and 4 gb ram which can run higher versions.
NOTE: If you are using Kotlin DO NOT use android studio 2! it does not have support for Kotlin if you use java or c++ go ahead (although you may give up some features.).

Unbearably slow android emulator -- is there a fix?

I know that the topic was discussed here last year, but I am hoping that someone has since found a fix. The emulator is simply not working for me anymore. It took 15 minutes or so to load hello world a few days ago, and now I can't get it to load a simple MapsDemo from the api samples no matter how long I wait.
I'm using eclipse with the android plugin (sdk and avd manager). My pc is 2.31 GHz quadcore with 8GB ram and windows 7 x64. Nothing is being logged in LogCat apparently.
Are there any alternatives or certain fixes I can try before buying a phone? I'd just upgrade my phone to an HTC Incredible and debug from the phone, but Verizon won't have any for at least a month and I'd really like to have my app out by then.
The best advice I've received is to use to target an older platform and a lower resolution. The emulator for Android 1.5 at HVGA is significantly faster to load than 3.1 at tablet resolution.
If you are running an emulator for a newer Android version, and want to see what it is doing while loading, you can watch on 'adb logcat'. It at least gives some better feedback than the word "Android" with a light shining across it!
Delete all your AVDs & re-install the SDK in a new directory. This should clear out any lurking config settings or AVD based issues which could be causing the slowdown.
Also try shutting down any virus/spyware scanner you may have running because you can then see if your AV app is trying to scan the AVD and or SD card images which could slow things down.
(btw, I'm running the emulator on a Quad Core Q6600 with 4gb RAM & Win 7 x64 and it starts in less than 1 min, so I doubt it's a compatibility issue).
I usually start it then after I see the "ANDROID" screen close it and restart it and it works and starts up a lot faster the second time.
I have started using ubuntu v11 (with dual boot) ,emulator is now starting within 40sec and working without any errors ,which i have encountered in windows 7 and performance is also good.
I just had the very same problem today, after I received the advise, to create a 400MiB SD Card on my AVD. I did so, but nothing worked anymore. I waited half an hour for my App to compile, but nothing happened even though the LogCat was still runníng ... So I came in here to find a solution and I did!
Here`s what speeded the whole thing up again:
I went to the AVD Manager (Window > AVD Manager in Eclipse)
Above the AVDs you can see the path where everything is stored that is created by the machine
So I went to that folder of the path and it was filled with previously compiled stuff
So I deleted it and voila, my App is run within a minute again!
P.S. It might be the case, that you won`t find the last folders described in the path, because they are hidden. Just type in that path, and they will be there: The hidden folders looked like this: .android\avd
Just type it in manually and erase all that stuff in there.
Using SDK Manager download and Install Intel x86 Emulator Accelerator(After downloading this SDK Package can find executable file at path "SDK_LOCATION"\extras\intel\Hardware_Accelerated_Execution_Manager Install it) and also Intel x86 Atom System Image packages.
Then create a new AVD with CPU/ABI as Intel Atom(x86), and Check Use GPU Host. Done!

Categories

Resources