Search code examples
androidoptimizationapkdevicerestart

What is Android "optimising" during restarts?


First question, appreciate some guidance. I am currently teaching myself to develop for Android and have installed my app (via Studio after builds) onto my own phone.

Every now and then my phone will restart itself (not querying that - these things happen).

During these (occasional) restarts I will get a message that Android is "Optimising App 1 of 1". I am pretty sure it is my app being "optimised".

I have searched here and the Web. Most of the questions seem to be users that have recently upgraded OS Version and that is causing the issue. There seems to be anecdotal evidence that wiping the cache cures this and that it only does it while the device is being charged.

However, if it is my app, I don't want users of my to go through this. I suspect it relates to the Target SDK I am using but it might be something different?

So, what is Android optimising? How can I make best efforts to stop my app being the cause of this?

Many thanks.


Solution

  • Earlier Android OS used to run on Dalvik Runtime which means apps used to compile at the time of execution. But now, Android has switched to ART with Lollipop version. It means all the apps will be compiled beforehand making them launch faster. So "Optimizing the Apps" basically means Android is compiling all the apps.