It constantly restarts with optimizing apps.

Some Background:

  • This phone was running on low disk space some days back, which I resolved by removing unwanted files.
  • Some apps are third party apps installed by downloading from websites.
  • I have searched other threads and none seems to be solving my issue.
  • I have done a "cache wipe" as well, which didn't solve the issue.
  • This has android version 6.
  • I am able to run Fastboot and have access to Fill-Z touch recovery.
  • I obviously don't want to format (easy solution) this phone as that would delete all the data in there.

Extra resource:

vimeo link describing problem

If anyone can let me know how can I disable this "Optimizing app" before the start, I'd be glad. Any help would be appreciated. Thanks in advance!

  • That usually means it has trouble with one app. The cyanogenmod tag lets me assume you've got a custom recovery on the device. Boot into that. Hopefully you have either ADB capabilities there, or the recovery includes a file manager (e.g. Aroma; twrp has both). Navigate to the tombstone folder (usually /data/tombstones) and check the "trace" block of the latest files. I suspect it always mentions the same app/package-name. If so, delete that app's data directory (/data/data/<package_name>). Next boot should succeed. // Had that recently myself … – Izzy Jan 12 '18 at 17:53
  • Note that mean you will lose that app's data as well! // Please let us know if that worked out. – Izzy Jan 12 '18 at 17:54
  • @Izzy Seems a good suggestion. Unfortunately, I am not that of an expert and my aroma file manager is not working right now. It says no cwm/aromafm/aromafm.zip in path'. Any help on getting that installed would be awesome. I do have adb and fastboot access but I am not that expert there either. – instinct Jan 12 '18 at 18:16
  • adb shell, then cd /data/tombstones. ls lists the contents. Viewing those files on-device would obviously be a bit tricky for you, so the easiest would be pulling them to your computer: adb pull /data/tombstones tombstones would pull the entire folder and place it onto your PC. Then investigate with the tools you're familiar with. Having found the culprit, from adb shell (as root) rm -rf /data/data/<culprits-package-name>. To exit from adb shell type, well, exit :) – Izzy Jan 12 '18 at 18:32
  • On rare instances, this could be corruption of the Dalvik/ART cache, possibly even a defective eMMC storage chip. Honestly at this point I would backup any data that is important and clean install (wipe everything). Once of the things anyone on a custom ROM should be prepared to do at any time is wipe all data and reinstall, kind of goes with the whole "custom rom" way of life, so to speak. – acejavelin Jan 12 '18 at 21:32

I had a similar issue not that long ago: the culprit seems to be some app ART cannot compile for some reason. As you successfully applied my solution and confirmed, let me sum up the facts from the comments in an answer:

1. figure which app is the culprit.

On each of those crashes, the Android system sets a "tombstone" on the "grave" of the dying process – something known on Unix/Linux systems as Core Dump. Those core dumps are placed into /data/tombstones, with at maximum 10 files kept (after that, the oldest one will be overwritten on the next occasion). So we need to look to those tombstones to see whats written on them. As you have a custom recovery which offers access, the easiest way is:

  1. adb pull /data/tombstones tombstones (will copy the entire directory to your computer)
  2. use a viewer/editor of your choice (best one you are familiar with) to open and investigate each of the tombstones, starting with the newest and walking back.
  3. look into the "stack trace" to see if an app (or it's path in /data/data) is mentioned there. If so, note it. If it's the same app in the next tombstone and the one after, you can be pretty sure this is the case we're describing here.

2. put the "obstacle" out of ART's way

Having identified the app, we need to remove it so doesn't get stuck with it. For this, again we need adb shell with its prompt – and the directory name from our tombstones:

rm -rf /data/data/<whateveritwas>

Note this removes all the data of the app as well – so having a backup in advance might be a good idea (in the current state: either adb pull the directory, or do a backup you can analyze later).

That done, reboot. Now "optimizing apps" should finish successfully.

Alternatives to the command-line approach

Some custom recoveries ship with an integrated file manager, usually called "Aroma". Above steps could also be perfomed with that:

  • navigate to /data/tombstones
  • view the tombstones
  • navigate to /data/data and remove the offender

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.