Android dies at 20% battery? It all started about three months ago when my HTC One (M8)'s USB charging port died. At first the port would sometimes not work, you just have to move the cable around a bit for it to charge, then you had to hold the cable down to make it keep charging, and finally device wouldn't charge at all.

The same exact thing happened to my HTC Vivid. When I got the Vivid fixed, the technician said it was water damage.

Anyway, after the local phone repair shop successfully installed the new USB port on my One phone, failing on the first try as it was still in the same condition, everything was fine. For a few weeks. Then the phone started shutting down as if it had no battery left, at 20%. I immediately plugged it into a charger, turned it back on, and the phone read 1%.

Its been doing that ever since. Some days it goes down to 0%, some days it goes down to 20% or 25% and dies.

Here's a screen shot of what is going on.


Under device settings, it says that the battery condition is good.

So I'm just wondering why my phone may be doing this, and what do you think the best option is to fix this.

I tried recalibrating the battery, clearing the cache, and installing a new ROM. None of the above worked.
There could be three reasons to this (not in any order)  :


Battery lived it's life.
Fuel Guage drivers corrupted.  To rule this out, i suggest back up your data and with your recovery wipe clean all Cache and system and flash stock(not sure if you cleaned fully when you flashed a ROM)  If the problem continues, it is likely that it is not a driver corruption issue. 
Hardware of battery charging chip gone bad. One possible way of checking this is to see if it is charging and discharging fully in safe mode. If  it  does unlikely to be hardware issue 


I would recommend step 2 first and then if possible borrow a battery to check if it is a case of  battery end of life. 

All the best and do post the conclusion