Lollipop 5.1 doesn't automatically connect to wi-fi After I upgraded my Nexus 5 to Lollipop 5.1, it does not automatically connect to wi-fi because Google is blocked in China and then the phone treated it as no network connection.

I have tried the solution here: How to disable captive portal detection? How to remove exclamation mark on Wi-Fi or signal icon in Lollipop?

However, it only removed the exclamation mark besides the wi-fi signal symbol, but the phone still won't connect to that wi-fi automatically.
I had the same problem with Android 5.1 upgrade on MotoX. 

What worked for me 
- switched off WLAN > restarted the router > switched on WLAN

Hope it helps.