Well you could try factory resetting your phone, and if that doesn't clear it, maybe try re-flashing the firmware? But ultimately, it may actually be a hardware problem that requires repair or replacement. Is it under warranty?
I have this same problem with my Coolpad, the only way I found to fix it is to force stop android system, restart the phone and plug in the charger while it's restarting. It should charge after that but then when you take the charger out the notification will come back or it won't charge so you have to do the same thing again whenever you have to charge it.
Go into Developer Options (settings-->about phone-->software-->tap build number 5 times or until it shows 'you're a developer!'
Change USB mode from MTP to Charge Only. Seems it assumes you're trying to transfer media for some reason. To this day I will never understand why Google removed 'USB Mass Storage' as a feature. AT least if this happened it'd produce a easily understood menu with 'turn on USB Storage' and 'Charge Only' with actual on-screen buttons. No need to figure out how to enable dev options.
I have had the same on a Galaxy Note 9 ... And think I have figured out why ...
This is an Android OS Issue ... Not Hardware Related !!!
The Phone has been connected to an extrrnal device (game controller, Flash Drive, Android Auto, or similar) and part of that connection was to change the USB Connection Defaults to suit that device. Reconnect the device and see if you get different options.
1. "AndroidAuto" was what changed the settings for me ... after I re-connected to AndroidAuto, and changed the preferences about auto-start and auto-play-music etc, the error message/notification went away.
2. My Phone charged again when cable was connected and I tapped the Notification "Android System - Charging connected device via USB - Tap for other USB options" and chose "This Phone" ... You MUST connect Charging Cable first, to get option for "This Phone"
Hope that helps ...
I just resolved this problem early today.
1. Connect my phone to another phone via USB, and then my phone starts charging this attached phone.
2.Go back to the menu of "Use USB to:", and select "Charge this device". Once done, my phone stops charging the attached phone.
3. Connect my phone to adapter charger , and then my phone is charged without any notification from system.