I had the same issue it would go away and come back.
What worked for me is i sprayed air in the port, deleted cache and data for usb settings. Booted into recovery wiped cache. I tried everything else and after a few frustrating weeks this worked.
@userKk9WQ5JM... Thank you for sharing your solution! We appreciate your contribution.
this worked for me, settings> apps> three dots> show system apps> scroll down to "usbsettings"> clear cache, clear memory> allow about a minute for the notification to go away.
The alcohol swab method works for me to get the phone charged, but as the humidity continues to be unbearable where I live, the error comes back within a couple hours. I think the sensitivity is set too high on the moisture sensor. I understand the usefulness of the feature, but I am not getting my phone wet and going about my daily life and can't charge it. That's not acceptable. Please fix!
if anyone is still having this problem I was able to use a different cable and it worked immediately. I noticed i had a small tear near the head of the micro usb cable that plugs into the phone. this part of the cable takes a lot of wear and tear and even if you can't see a tear there could be a problem on the inside preventing charging