It seems you got the solution from fellow members,
Anyway, the first thing that you will need to do in this case is to check what apps are using the most storage space.
For Android Nougat -
From any Home screen, tap the Apps icon.
* Tap Settings > Device maintenance.
* Tap Storage.
* View the Available space value.
For Android Marshmallow -
* From any Home screen, tap the Apps icon.
* Tap Settings.
* Tap Storage.
* View the Available space value.
You can clear the cache and data of the app or group of apps that are using up too much space. You can also opt to uninstall them if you are not really using them.
You should also clear out some data on your phone by performing the following steps.
* Delete unnecessary text messages and picture messages
* Transfer pictures and media to a computer to remove them from the phone memory
* Clear the browser cache, cookies, or history
* Clear Facebook app cache
* Delete call logs
In case the out of storage error message still appears then you should proceed with the additional troubleshooting steps listed below.
* Wipe the cache partition of the phone from the recovery mode.
* Backup your phone data then do a factory reset.