Although Android Studio is a powerful IDE, there are many memes about long building time, slow speed, taking huge amount RAM etc.
According to developers.android.com, minimum requirement for android studio is:
- 4 GB RAM minimum, 8 GB RAM recommended
- 2 GB of available disk space minimum,
- 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
- 1280 x 800 minimum screen resolution
However Windows usually takes 2GB and Android Studio will alone take up to 1GB and if you run with emulator, it will consume about 1.5GB - 2 GB. So basically, when you try to run Android Studio in Windows with emulator, it's gonna be a very huge pain in the ass.
So, How can we speed up our Android Studio in a laptop with 4GB RAM? The best way is to upgrade your RAM to 8GB as recommended in official website. (Just kidding..xD I'll be more serious after this). There are several ways to speed up your Android Studio. When I learned android development for the first time, my laptop had only 4GB RAM and I went through so much trouble to run an android app. It took about 15 minutes to build gradle and opening the emulator will take about another 15 minutes. So, here comes the tip.
If your laptop has only 4GB RAM, don't run your project with emulator or it will end up in a complete disaster!
Running with a physical device will reduce both your anger and loading time of the android project. So, I recommend you to use your android device instead of emulator to test the apps.
Another way to speed up android studio is to run it in different OS rather than Windows. As I've said above, Windows OS usually takes 2GB as there are many background processes and system process running in Windows that you can't stop. So, another tip is to dual boot your laptop with a Linux distro or just remove Windows completely and use Linux instead :P Currently I use Debian OS with Windows dual boot and my laptop RAM is 8GB. According to my experience, starting Android Studio and running an project in Debian is much faster than in Windows. So, here is another popular tip.
Use Linux. Run Android apps with your android device instead of emulator. Then, 4GB RAM will be sufficient to run smoothly without any lags.
However, if you are too attached to Windows, it's ok. Let it be. I'll telling another way to speed up Android Studio in your Windows Laptop.
Go to Android Studio first.
Then, click Power save mode
. It will reduce lots of background work in Android Studio.
After that , click File > Setting > Plugins
.
As I disabled the plugins that I don't need, you won't see so many enabled plugins in my laptop.
However, in you laptop, you will see so many enabled plugins and these are also the things which slows down your IDE. You will see IDE gets slower when adding plugins. So, if you disable all the plugins that you don't use (I know you are not using all these plugins to develop your app), I guarantee that Android Studio will speed up for sure.
I disabled the following plugins in my IDE:
- Android APK Support
- Android Games
- Android NDK
- App Links Assistant
- Change Reminder
- Copyright
- Coverage
- Editor Config
- Firebase App Indexing
- Firebase Testing
- Google Cloud Tools Core
- Google Cloud Tools for Android
- Google Developer Samples
- Google Login
- Google Services
- Mercurial
- Settings repository
- Subversion
- Task management
- Test recorder
- TestNG
- YAML
After that, click
Apply
and restart your Android Studio.
But wait. What if you need Any Plugin Later? Easy Buddy! Relax. For example, if you are adding google services or firebase in your app in the future, just go back to plugins and enable again.
If you are also using any antivirus, make sure to add Exception of all android studio directories. So it won’t scan those folders while you are using Android Studio. This will make it even faster. As for default Windows Defender, you can follow this guide to add exception for Android Studio.
You can follow these tips from official documentation to improve the build speed of your Android Studio project.
Here's my final tip 😛:
Hope you guys won't suffer from Android Studio nightmares. Peace!