Prashant
Prashant

Reputation: 1613

Android studio uses 100% CPU while just coding (no builiding)

Android Studio uses 100% CPU when I'm just coding, even if I type a single word CPU use raises to the 100% and comes to back normal, and if I keep typing it takes 100% CPU all the time.

What I have tried is :

I'm running windows 7 64-bit OS and Android Studio 3.0 and OS which I re-installed yesterday. I did not install the JDK - Android Studio is using default OpenJDK.

I've searched on internet but it did not help. any help would be appreciated.

Upvotes: 16

Views: 9305

Answers (6)

Ramya Bm
Ramya Bm

Reputation: 19

Go to: Preferences > Version Control > Background. Now listed under 'Background Operations' are 6 options. I disabled the first three options which are:

Perform update on VCS in background, Perform commit to VCS in background, Perform checkout to VCS in background.

This reduces lot of power consumption of the CPU

Upvotes: 0

Khemraj Sharma
Khemraj Sharma

Reputation: 59004

It seems your systems config is low. as Android studio cares of itself for CPU uses so it gives its best.

Reasons being

  • You have Core 2 duo that is too low for Android Studio.
  • You have 4gb Ram, that is too low again.

If you work on some large project then 2gb of ram is necessary for Android Studio. and Java takes unexpected upto 4gb or more.

Solution

  • Increase ram by 8gb and processor at least intel i3

  • kill java or invalidate cache and restart if you get stuck of hanging your android studio.

Here is my CPU uses that goes upto 3gb for Android Studio and upto 4gb for Java.

enter image description here

The recommended hardware requirements for Android Studio are:

Microsoft® Windows® 8/7/Vista (64-bit Recommended)

Intel i5 4th-5th gen processor.

6 GB RAM

2 GB hard disk space + at least 1 GB for Android SDK, emulator system images, and caches

Optional for accelerated emulator: Intel® processor with support for Intel® VT-x,

As Java uses it’s own Machine known as JVM(Java Virtual Machine) for program compilation and it has some complex tasks like generate classes then verify byte code and then execute program with JIT(Just In Time)

And as Android has Natively developed in Java the slow compilation will be the issue i presume. But with new Android Studio feature known as “Instant Run” compilation and development of Android apps made more easy.

As i am developer of Android apps, I use

Intel i5 6th gen 2.70 Ghz processor

12 GB of RAM (8GB in first slot and 4 in Second Both DDR3) 1 TB of Hard Drive Nvidia G-Force 940M 2 GB of Dedicated GPU for running Adobe After-Effects, Maya and Unity like Software which needs Dedicated GPU. That’s all and Still Android Studio sometimes Lags with such high performance Hardware with the more complex and big apps(Complex Projects).

I think if you are going to buy a hardware and use it for at-least 3 years get the exact specs i have (or similar), However if you are frequent hardware changer use specs i mentioned first.

And for Emulator use Genymotion as it is way faster then the emulator which Android provides. Or use some other alternatives like Memu, Blustacks, Andy etc.

Upvotes: 2

flash76
flash76

Reputation: 382

If you have any USB drives laying around, try using those for ReadyBoost. It may help you.

For the uninitiated, ReadyBoost, in a nutshell supposedly makes your WINDOWS PC faster by using how much ever space you dedicate it to (aka extra RAM)

For the uninitiated, to set it up,

  1. Plug your USB / SD /WHAT EVER DIGITAL STORAGE you have into your computer
  2. Go into Windows Explorer > This PC > Right click on Whatever storage you have plugged in
  3. Select Properties in the Context (right click) menu
  4. Go to the ReadyBoost tab
  5. Choose what to do with it

Upvotes: 0

fhery021
fhery021

Reputation: 317

Unfortunately, the new Android studio do require RAM.

" You can download Android Studio 1.5.2 which should support 2Gbs of Ram And I would also recommend you to move to Linux Ubuntu OS from Windows 10 as you can set a portion of your Hard disk space as Ram memory(4gbs recommended) during installation(Search on Youtube on how to do that)." Source quora:

Upvotes: 4

Mohammad Aldefrawy
Mohammad Aldefrawy

Reputation: 563

Did you try to set the power plan to best performance instead of balanced plan. This may consume the battery but may solve this problem.

Upvotes: 0

vrudas
vrudas

Reputation: 66

Try to add more Heap memory for Android Studio, go to Help -> Edit Custom VM Options... and set -Xmx2g (depends on your project size), after restart AS.

Upvotes: 0

Related Questions