Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Windows vs Ubuntu vs macOS

Same SSD, the same project, the same version of Android Studio. Dual boot W10 and Ubuntu 17.10. On Ubuntu, Android Studio launches, loads the project and finishes sync and gradle compilation in 12-14 seconds, on Windows 10 it takes 53 seconds.

Fresh install multiple times on both systems. Also, on a late 2015 iMac with system configuration almost identical to my pc, the times are almost identical to those on Linux.

YOUTUBE: Windows vs. Linux (Android Studio): https://youtube.com/watch?v=K4HR2pVQdDo

LE: After I disable windows defender for all folders with Android Studio, Android SDK and project folder and deactivate the Windows Search service, I reduced to 38 seconds.

I still have a huge difference over the 12-14 seconds on Linux and MacOS. Fresh install of W10 with up-to-date updates.

On Windows after the project is loaded, Android Studio does some gradle and sync compilations for more than 20 seconds. On Linux and macOS it takes up to 4 seconds.

What is the explanation and how can Android Studio upload the project in Windows as fast as it does it on Ubuntu and MacOS?

This happens every time I start Android Studio and open the project (later compilations are also fast on Windows, although Linux and MacOS are faster).

Why is so slow on Windows?

Is there any conclusion / resolution? Or is Windows really an Android & Java development avoided OS?

Those steps that run only on Windows I do not manage to see on Linux and macOS - or they run instantly or they don't run at all, but it is certain that those things take over 20 seconds on Windows:

IMAGE: Windows gradle compilation and sync, takes over 20 seconds

like image 343
Ovidiu Muntean Avatar asked Jan 07 '18 13:01

Ovidiu Muntean


People also ask

Is Android Studio faster on Ubuntu?

Linux performs better for Android Studio than Windows. Android Studio needs at least 8 GB RAM to run better. Change your Hard Disk to SSD.

Which is better for Android development Windows or Linux?

There is nothing in Linux regarding android development which is not possible in Windows. Though if you have never used Linux environment then stick with Windows to keep things simple.

Can MacOS run Android Studio?

To install Android Studio on your Mac, proceed as follows: Launch the Android Studio DMG file. Drag and drop Android Studio into the Applications folder, then launch Android Studio. Select whether you want to import previous Android Studio settings, then click OK.

Which window is best for Android Studio?

The System Requirements for Android Studio on Windows Your PC must meet the following requirements to run Android Studio efficiently: 64-bit Microsoft Windows OS 8/10/11. 1280 x 800 minimum screen resolution.


2 Answers

Try disabling anti-virus protection for your Gradle caches directory, Android Studio project directory, and additional Android directories listed below. For me, this made a huge difference. From what I've read, a big chunk of time is spent doing anti-virus scanning on intermediate files and JARs, and this dramatically slows Java compilation. Excluding those same directories from Windows search indexing can also help.

As of September, 2020, this is the list of default directory locations that should be exluded from virus scanning and Windows search indexing, published here.

  • Gradle cache: %USERPROFILE%\.gradle
  • Android Studio projects: %USERPROFILE%\AndroidStudioProjects
  • Android SDK: %USERPROFILE%\AppData\Local\Android\SDK
  • Android Studio system files: %USERPROFILE%\.AndroidStudio<version>\system

I published some instructions on my blog for doing this for Windows Defender and Windows Search Indexing, which I'll repost here for completeness:

Windows Defender - How to Exclude a Directory

  1. Open Windows Defender Settings
  2. Click "Virus & threat protection"
  3. Click "Virus & threat protection settings"
  4. Scroll down to "Exclusions" and click "Add or remove exclusions"
  5. Click "Add an exclusion" and select "Folder" from the drop-down menu
  6. Navigate to the directory to be excluded, or paste its path into the "Folder" text-box, and click "Select Folder"

Windows Search Indexing - How to Exclude A Directory

  1. Open Windows Control Panel
  2. Search for "index" and choose "Indexing Options"
  3. Click the "Modify" button
  4. Under the appropriate drive letter, navigate to the folder you want to exclude, and make sure it is unchecked
  5. Double-check your work by verifying the directory shows up in the "Exclude" column of the "Summary of selected locations" table
like image 116
Mark McClelland Avatar answered Sep 27 '22 18:09

Mark McClelland


So damn true! I experienced the same thing. Build time go down to hell on Windows and go up to heaven on Ubuntu/Linux distros, even on very very strong CPU power computer. I guess JVM is just simply can't perform well on Windows OS.

like image 35
Hoang Nguyen Huu Avatar answered Sep 27 '22 19:09

Hoang Nguyen Huu