You can solve your problem and fix the issue of Gmail IMAP not Working by clearing out your cache and cookies. Go to settings> clear browsing data, select cached images and files, and delete all of them. This should fix any problems with how Gmail isn't working. If you still have issues, you might need to clear your cookies. To do that, go to settings> Privacy and security>Clear browsing history. Then select Cookies and other site data and clear everything there as well. This will clear out any old or corrupted cookies that may be causing your issue and give you a fresh start on new ones.