A slow Android Studio is a pain in the butt for an android developer. Developing an application with a slow IDE is not a cakewalk. It’s also annoying that when you are focusing on the logic building for your app, and you got a kick to work and at that time your android studio suddenly starts lagging. You will really not feel good at that time. In the previous versions, the android studio was more heavy software Google is updating it and making it more scalable for developers. But it is even also heavy software which will suck your computer’s ram. If your pc is not having a high configuration you can’t run other applications like Google Chrome when your android studio is running. If you try to do so then your pc will start hanging.
In this article, we will try our best to solve this problem. We will try to set up an android studio like a charm so that we can run a smoother development environment. It will save our time in developing an application and will also not be going through a painful process at the time of development.
Minimum space and configuration requirements: Officially android studio requires a minimum of 4GB RAM but 8GB RAM is recommended for it. It also requires a minimum of 2GB Disk Space but 4GB Disk Space is recommended for it. But these are the minimum requirements.
It’s been observed many times that android studio is actively consuming ram of 4GB. So, First of all, we have to think that, in order to speed up the android studio what are the steps we have to take. This article will be divided into two parts in the first part we will see that how can we speed up the build process of android studio and in the second part we will know that how can we fast this slow and heavy software called the android studio.
Speed Up Your Gradle Build Process
The Gradle build is the most important part of developing an android application. Sometimes it takes much more time than it should then it becomes a painful process. These are the few best tips to reduce the Gradle Build time.
Step 1: Enable Offline Work
Many times we don’t need to go with the online build process of the Gradle we can do it offline. Why not do it in offline mode. It will save our time and escape the unnecessary checks for the dependencies. We can always enable the online build process when we require this. We can turn it off for now. Go to View >> Tool Windows >> Gradle and then click on the icon Toggle Offline Mode. Again clicking on the icon will off Offline Mode.
Step 2: Enable Gradle Daemon and Parallel Build
Enabling Parallel Build will reduce Gradle build timings cause it will build modules parallelly. Enabling the Gradle Daemon will also help to speed up the build process. Go to Gradle Scripts >> gradle.properties and add these two lines of code.
Java
# When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. org.gradle.parallel= true # When set to true the Gradle daemon is used to run the build. For local developer builds this is our favorite property. # The developer environment is optimized for speed and feedback so we nearly always run Gradle jobs with the daemon. org.gradle.daemon= true |
Step 3: Enable Incremental Dexing
Turning on Incremental Dexing will also speed up the build process of the application. Go to build.gradle(module:app) and add this block.
Java
dexOptions { incremental true } |
Note: From Android Gradle Plugin 8.0 onward, there is no need to use dexOptions as the AndroidGradle plugin optimizes dexing automatically. Therefore using it has no effect.
Step 4: Disable Antivirus
In the Gradle build process, the android studio needs to access multiple files repeatedly. An antivirus is by default don’t giving direct access to the android studio to those files it will check the file and then it gives the access. The procedure of checking files first and then giving access to android studio slows down the process of Gradle build. So if you are confident enough that on your pc you haven’t downloaded any malware files from unauthorized websites or locations then you can turn the antivirus off. It will also help in speeding up the process of the Gradle Build. I think there’s no need to tell you that how can you turn off the antivirus of your pc you would be knowing that.
Step 5: Disable Proxy Server of Android Studio
By default proxy server is off in the android studio, but in some cases, your proxy server may be on. Disabling it will help to run a smoother build process. For disable it, Go to File >> Settings >> Appearance and Behaviour >> System Settings >> HTTP Proxy and Select No Proxy.
Make Android Studio Smoother and Faster
We have done some factful settings for speeding up the Gradle Build process. Now let’s do some settings which can help us to make our Android Studio Faster.
Step 1: Disable Useless Plugins
There may be many plugins in Android Studio that you are not using it. Disabling it will free up some space and reduce complex processes. To do so, Open Preferences >> Plugins and Disable the plugins you are not using.
Step 2: Use SSD
A solid-state drive is a great product in which you can invest. It will not only fast up your android studio it will also fast your PC 2 to 3 times. SSD has really faster than Hard disk drives.
Step 3: Adjust memory setting
Go to Appearance & Behavior >> System Settings >> Memory Settings. Tweak these settings according to your preference. Increasing a little bit of heap size can help. Too much heap allocation is also not a good thing.
Step 4: Ignore Thumbs.db
Go to File>> Settings>> Editor>> File Types>> and in Field of Ignore files and Folders add Thumbs.db. It also can speed up your Android Studio.
Step 5: Free Up Space and Cache
For clearing the Gradle Cache:
On Windows:
%USERPROFILE%\.gradle\caches
On Mac:
/ UNIX: ~/.gradle/caches/
For Clearing the cache of the whole android studio:
File >> Invalidate Cache and Restart.
Step 6: Delete Unused and Unwanted Projects
In our android studio projects folder, many junk apps can also exist which we have created somehow but we have not done any work on those apps. The apps that exist are not needed for you then you can delete these unwanted apps it will free up space and remove a little unwanted load from android studio. For doing so, check the following path:
C:\Users\%USER%\AndroidStudioProjects
and delete those junk apps.
Step 7: Try to use a single project at a time
We have talked before on the topic that how much heavy software is the android studio and how heavy the process is the gradle build of the application. If we are not having a high configuration PC then we should not work on many apps at the same time and also should not do the gradle build for two applications at a time. If we are doing so then it may cause that our pc can be hanged. We should work on a single project at a time.
Step 8: Try to run the application on a physical device instead of an emulator
Android studio provides the emulators for running our application for development purposes. Emulators provided by them will also be putting an extra load and make android studio bulky which can be a cause for the hanging of android studio. We should run our application on a physical device instead of that emulator it will lead to a smooth development process. You can refer to the article How to Run the Android App on a Real Device?
Step 9: Update android studio
Google is also trying to make smoother and faster IDE for the Development. He is trying to update its algorithms and make the android studio as fast it can be. So updating to the latest version is a useful step for you if you are running on the older versions. So you should keep your Android Studio Updated.