The problem is not with android, bcoz android is just an OS. The problem is with Samsung quality, their charging system is very flimsy. You can replace it though.
Im having same problems on samsung not phone, so l bought a spare oem charger and batter plus a new charging system which l have yet to change.
I will update when l change it.