Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Takes too long time to run the app on real device

I have a Laptop with a Core i3 processor and a 2GB of RAM, and I am using my Sony Xperia C as an alternative to the Emulator. When I click on debug and choose my mobile device, the Gradle starts building and it takes about 5 to 10 minutes to finish. I understand that I have very low resources but I doubt that there is another reason why it takes too long time to finish building and running the app.

I noticed in the logcat tab that it is spending the time on sending a request and waiting for a response repeatedly..

Can anyone tell me if the problem is with the hardware resources or my doubts are true about the cause being something else.

like image 769
AliSmart Avatar asked Jun 24 '16 02:06

AliSmart


People also ask

Why is Android Studio running so slow?

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.

How do I fix lag on Android Studio?

Android Studio needs at least 8 GB RAM to run better. Change your Hard Disk to SSD. Loading/Compiling/Designing/Writing time will be reduced even in 4GB RAM. Use Power Save mode from File Menu that will reduce lots of background work.


4 Answers

Android Studio is very resource hungry. I use an old Sony with Core 2 Duo and 2.5 GB of RAM, with tweaked system that running about 200MB for the operating system. It takes about 10 minutes or more to build a project.

My suggestion, upgrade your Laptop RAM to 4GB or more. 8GB should be enough. Now I'm working with 4GB and Corei5 where Android Studio take about < 1 minutes to run a project, but it depends of the project size and its dependencies.

-- UPDATE --

Default setting of Windows 10 will use about >90% of your disk which will make your building process much more slower. You could decrease it to <12% by simply turning off "Show Me About Windows":

From the Windows Menu, go to Settings, then go to System and then go to Notifications and Actions. Turn off "Show Me Tips About Windows"

update reference: Disk usage always at 100%

like image 61
ישו אוהב אותך Avatar answered Oct 17 '22 03:10

ישו אוהב אותך


In my case, I don't use debugger for monitoring app performance ...etc, So I do not install app to device (I build application only instead of run), then I use adb to install apk to device ...

adb install -rst <$$path_to>.apk

path_to_apk is where my apk gets built Usually ...

<$$build_path>/android-build/build/outputs/apk/my.apk

I get things work with a reasonable speed , offcourse, on the cost of debugger!
I am then trying how to activate debugging from adb! if possible and needed.

like image 22
Mohammad Kanan Avatar answered Oct 16 '22 01:10

Mohammad Kanan


I would strongly recommend that you either upgrade your development machine's RAM (8GB or more) since 2 GB ram will be too painful for studio.

Also I recommend: open single project at a time and clean your project after running your app in emulator every time.

like image 3
Developer Avatar answered Oct 17 '22 04:10

Developer


After upgrade your RAM, you should try to upgrade Android Studio. In Android Studio v2.0.0 ++ , they support Instant Run

Android Studio now deploys clean builds faster than ever before. Additionally, pushing incremental code changes to the emulator or a physical device is now almost instantaneous. Review your updates without redeploying a new debug build or, in many cases, without restarting the app.

More info about Instant Run

like image 1
Fuyuba Avatar answered Oct 17 '22 05:10

Fuyuba