Tech Nerd
Tech Nerd

Reputation: 832

How to Speed up Android Studio 3.0

I just want to ask "How can I speed up my Android Studio?". Though I do own:

Dell Inspiron 15R 
12GB of RAM Core i7 (N5537),

these specs may look cool but still I am unable to working on Android Studio in Peace. As my Android Studio takes a lot of time when I reboot my machine and start the Android studio, its indexing process is way too long, the gradle build process is also way too laggy!


Even whenever I try to run my app on any device say on Virtual Device or any other real device it takes a lot of time, to switch between .java to .xml files is also way too long! For the most of times the Android Studio also stuck and hangs on different events especially on Gradle Build or refreshing the project and indexing the project files!

Upvotes: 3

Views: 4005

Answers (4)

Mr-IDE
Mr-IDE

Reputation: 7661

To prevent the excessive "Indexing..." when launching Android Studio (with multiple projects open), you can switch on File -> "Power Save Mode". This makes it start up much faster. It also saves a lot of CPU in general, for example when typing code. You can switch it back on when you need the live inspections.

More info: https://jwhh.com/2013/06/07/android-studio-power-save-mode/

Upvotes: 0

CodeBulls Inc.
CodeBulls Inc.

Reputation: 462

Config + SSD made a huge difference!

Tweaking Paging Size, Clearing Temp Files and Cache do help but you wouldn't not have taken time to post here for saving a few seconds.

For marginal performance boost, We upgraded the machine and it's worth it.

Machine Specs: Alienware-i7 7820HK|16GB RAM|256GB PCie SSD|1TB HDD Software Config: Android Studio in SSD|SDK in HDD|Project Folder in HDD

Clock Time to load Android Studio: 9s Clock Time to create a new empty project: 20s till Gradle Build Finished Clock Time to open an empty project: Less than 5s till Gradle Build Finished Clock Time to open Android Studio; create a new empty project: 40s till Gradle Build Finished

If you could keep track and manage Android SDK properly, and predominantly use AS alone, we recommend an All-in-SSD approach.

Regards.

Upvotes: 1

Tech Nerd
Tech Nerd

Reputation: 832

For the above issue, I have done some work around to speed up my Android Studio. In other words the results are just boosted my Android Studio!


Step 1 Increase Windows Virtual Memory

  1. Goto Computer, Right Click and Choose Properties
  2. Select Advanced System Settings

enter image description here

  1. Select Performance Settings

enter image description here

  1. Select the Advanced tab, and click the Change button on Virtual Memory Section

enter image description here

  1. Uncheck the Automatically manage paging file size for all drives
  2. Choose your desired drive to use as a Virtual Memory Part
  3. Check the Custom Size Radio Box
  4. Insert the Inital Size (MBs), this step is important! For me I have about 150GBs free in my C Drive so I set the initial size to 40GB!
  5. Set the Maximum Size (MBs), I have set it to 50GB because have a lot of free space!

enter image description here

  1. Click Set, then Ok

Step 2 Edit Custom VM Options in Android Studio

  1. Start Android Studio
  2. Click Help
  3. Select Edit Custom VM Options
  4. Click Yes to the Next dialog (If file didn't exists already it will prompt you to create one)
  5. Add these Lines to that Opened File:

     # custom Android Studio VM options, see http://tools.android.com/tech-docs/configuration
    -Xms1024m
    -Xmx4096m *****INCREASE THIS TO MAXIMUM OF YOUR RAM
    -XX:MaxPermSize=1024m
    -XX:ReservedCodeCacheSize=1024m
    -XX:+UseCompressedOops
    -XX:+HeapDumpOnOutOfMemoryError
    -Dfile.encoding=UTF-8
    

(You Should increase these values to the maximum of your machine resource, the above is for my own machine settings)


Step 3

  1. Simply Invalidate Caches and Restart Your Android Studio
  2. Don't forget to edit your startup programs and service, you have to disable all junk/useless or non important services at the startup and reboot! (This step is also very important)
  3. Give your machine a Reboot
  4. For me these all steps are a great workaround, so you should give them a try
  5. Please Note that you should set all the said values according to your machine hardware and software resources

Thanks

Upvotes: 2

gbruscatto
gbruscatto

Reputation: 696

What SO are you using? I'm using the same version of Android Studio on an Acer with Windows 10, 8gb of RAM and i5-7200U, and I'm not facing these problems. Try to defrag your disk, or use a SSD, it helps a lot.

Upvotes: 0

Related Questions