I had this problem and I just got a q-tip with rubbing alcohol and cleaned up the charger and charging port, and then blew it out with a can of air, and it works fine now.
open