Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Build uses 100% CPU on Windows 10

After upgrading to Windows 10 building a project in Android Studio makes the PC unusable.
With Windows 10 the build did also take a long time, but the PC was useable in the meantime.

The TaskManager shows that the java-build-task uses as much CPU as it can get.

Setting java and or gradle-options did not improve the CPU usage.

Currently using:
Android Studio 2.1.0
Gradle 2.1.0
Windows 10

like image 575
JDurstberger Avatar asked Jan 07 '23 04:01

JDurstberger


1 Answers

Creating a new shortcut which launches Android Studio with restricted CPU affinity did the trick for me.

  1. Desktop > right click > New > Shortcut
  2. Set location to cmd.exe /c start "Android Studio" /affinity 0x03 "C:\Path\to\ANDROID_STUDIO"
  3. Set desired name of shortcut
  4. set Icon to C:\path\to\Android Studio\bin\studio.ico

The number for affinity are the hexadecimal encoded numbers of the cores to use.

Core4 Core3 Core2 Core1 = 0x0F //uses all cores 
            Core2 Core1 = 0x03 //uses only first 2 cores

I experienced no noticeable worsening in build times.

like image 59
JDurstberger Avatar answered Jan 11 '23 02:01

JDurstberger