Remove everything but first 'source-directory' line in /etc/network/interfaces
.
Using nano:
sudo nano /etc/network/interfaces
Use CTRL+K to delete lines, CTRL+O to save, and CTRL+X to exit nano editor.
Enable 'dhcpcd' with:
sudo systemctl enable dhcpcd
sudo systemctl disable networking
Restart the Pi to have the changes take effect.
Reboot from GUI, or use terminal command:
sudo reboot
WiFi should work now.
I tried reinstalling the new OS from the official site, still facing the same issue. I am using raspberry pi 3B