My Xperia Z1 is failing to complete startup... it shows the "Andriod is starting... optimising application x of xxx" msg but reboots when it finishes optimising and starts the process over again. This started after the battery ran down completely.
Firstly i would suggest that you try removing the SIM card, and then try restarting the phone. If the phone restarts successfully after you remove the SIM card it might be the SIM card that needs to be replaced. Secondly you could also try to remove the SD Card if you have one. If the phone restarts successfully after you remove the SD card, your SD card may be damaged and in need of replacement.
If none of these measures manages to get you past the boot screen I recommend that you try to perform a software repair using a computer and Xperia Companion. Please note that since the device cannot be fully started, you need to start the repair without the phone plugged in and make sure to tick the box in the bottom left corner "My device cannot be detected or started, or is a Smartwatch 3" and then click on "Next". After this you should be able to follow the on screen instructions given by Xperia Companion.