This problem might be caused by several ways, which require separate solutions. Let's have a look at them:
Firstly, check your WiFi signal. It should be blue (on stock ROMs), which means you're connected to Google Play Services. If it's grey, there's a problem with that. Solution?
Try to erase&add your Google Account, check synchronization, delete data+cache on Google Play Services, Google Play, or whatever causes the problem. Helped? If not, proceed to another step:
Your WiFi signal might be either blue or grey but it doesn't really matter if there's a problem with hosts.
This is going to be complicated (not really). The only thing you need to do, is to revert back the hosts by removing them, follow this simple guide how-to:
This guide requires root access.
- Get a root explorer (Total Commander, ES Root Explorer, Root Browser..)
- Navigate to /system/etc
- Find a file called hosts
- Open it as a text file, delete everything it contains.
- Paste there this only: 127.0.0.1 localhost
That's all! Wasn't that hard, was it? If you have problems with opening the hosts file due to a massive amount of hosts, create a new file called just hosts, paste the code (127.0.0.1 localhost) to it, save and reboot.
Don't forget to check the correct permisisons (rw-r--r--)!