Nexus 5 won't stay charged, shuts down immediately. What do I do?

A

AC Question

Nexus 5 won't stay charged, shuts down immediately

My Nexus 5 won't charge; if on charger, it shows it is charging, but the battery level never rises. When it is ON the charger, it will boot normally, and I can use it normally, but as soon as I unplug it from the charger, it immediately shuts down with a message to connect a charger. When it's not on the charger, I can try to boot it, and the Google logo will come up, but then it immediately shuts down again. I have had the battery replaced, and that did not solve the problem. Funny thing is, even though it says the battery is dead, if I boot into recovery mode, that screen will stay on for a very long time -- nearly an hour -- without any battery warnings. So it seems it's only after Android tries to boot that the issue comes into play. The phone is not rooted. Any clues as to why it won't charge, even with a new battery, but works fine while on the charger? And why would it be able to run off the battery in recovery mode, but not when booting normally?