How do I use app optimizing on start up?

A

AC Question

App optimizing on start up

I have a nexus 5 that is less than a year old. Starting just 2 weeks ago my phone will turn itself off randomly. When I try to power it back it will either 1. keep looping through the google display(literally says google in white with black background then going completely black again) for a couples of times. or 2. Display google then shut it self off again. I have to power it back on again, and it may or may not do the same thing. or 3. start after one attempt.
For all cases after it starts it will say something like optimizing apps # out of # and I have to wait a couple of minutes for it to go through the process. The it will work normally after.
On rare occasions it just starts normally doing anything weird.
Ive tried to take out the battery and putting it back in, didnt help.
Can someone please help me? Much appreciated.