You are an amazing android developer and love to develop awesome apps but your android studio is not so fast, you might have experienced sluggishness or slow responsive of the android studio. Today I will give you some tricks to make it faster.
First of all, I will recommend you to increase your RAM memory of your computer, because Android studio runs best on 8GB of RAM or higher. It tends to run pretty better on 4GB of RAM but when you open other softwares like firefox, chrome or anything with the android studio, one of the software or both of them at a time will give you "Not responding!" error message, which is quite irritating!
So let's start!
1. Enable Offline work
You can enable offline work in the android studio to make it faster. Here's how you can do it.
- In android studio, go to File(located on the top left corner) -> Settings or you can simply use this shortcut Ctrl+alt+S
- New window will be popped up on screen which will look something like this
- Next, click on Build, Execution, Deployment section which is located in the side menu.
- Under that section, click on the Gradle section, and check ✅the Offline work under 'Global gradle settings' and hit the OK button like this
- Now again go to file-->settings and click the Compiler tab under Build, Execution, Deployment section and type --offline in the Command-line option box and then click on OK button like this
- Now, restart your android studio and feel the difference.
2. Improving Gradle
- Open Android studio, click on the gradle.properties section in the left side menu under Gradle Scripts section and add these two lines below:
3. Use Instant Run
While
running your debug apk on an emulator or on your real android phone you
may know the time it takes to deploy the apk into the device is more
even if you change some minor bit of code it rebuilds the entire apk or
restarting the current activity.
In
Android Studio 2.3 and higher, Instant Run significantly reduces the
time it takes to update your app with code and resource changes. After
deploying your app to a target device running Android 5.0 (API level 21)
or higher, you can click Apply Changes
to push certain code and resource changes to your running app without building a new APK.

You can know more about it here on how to use it.
4. Testing your app? Real android device or emulator
Android
studio provides you built in emulator which is really very slow and
eats lots of RAM memory. I know when I tried to run my first android app
on the emulator it had taken lots of time to just run the simple app.
After that, I switched over to Genymotion which is quite better as compared to the android studio built in emulator but it doesn't worked out as I want.
After
trying all these different emulators finally I started running my app
on my android smartphone which turned out be really nice because the apk
uses the smartphone hardware resources to run rather than the emulator
which uses computer hardware resource.
To run your app on the real device you must know these 2 things:
- You must enable USB debugging option on your android smartphone.
- Install the appropriate OEM USB driver on your computer.
How to enable USB debugging on your smartphone?
- Go to settings on your smartphone, scroll down to bottom you will find Developer options if it's not there continue reading next step.
- Scroll down to bottom and click on About phone.
- Now again scroll down, you will find Build number.
- Click the Build number section 6-7 times until it says "You are now a developer".
- Once you have done with the above steps come back and you will see new option i.e. Developer Option.
- Click on Developer option and scroll down until you see USB Debugging click on that and enable it.
- Now you have successfully enabled USB Debugging on your phone.
- Go and find yourself a USB cable and connect your phone to the computer.
- Go to the OEM USB driver website and install the appropriate driver that you want on your computer.(The link that I have provided above also contains the information on how to install the driver on your computer)
- Once you downloaded your appropriate file unzip it.
- Now open the SDK Manager (To open SDK Manager from android studio, click on Tools > Android > SDK Manager or click SDK Manager
in the toolbar)
- Download the Google USB Driver from the SDK Manager and install it.
- Now connect your phone to computer(USB Debugging should be enabled).
- Move on to Device Manager on your computer and select Portable Devices –> Your Device Name.
- Now right click on Your Device name and click on Update Driver software and select "Browse my computer for driver software".
- Now click on Browse button and point it to " C:\Users\YourUserName\AppData\Local\Android\sdk\extras\google\usb_driver" and check the Include subfolders checkbox, hit next and finish.
- Now open android studio and to connect your phone to computer with USB debugging enabled and when you are ready click on Run button and select your device and click OK button like this
Note: If your smartphone OEM USB Driver is not available in the list of OEM Drivers(e.g, XOLO smartphone USB Driver is missing on that list) you will need to install Android USB
No comments:
Post a Comment