Error:Unknown host \'This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server\'.
Sometimes this works for me, when there's a sudden gradle syncing problem which should work fine (or previously worked fine).
Build with local gradle distribution
Download a gradle release archive from here to path android-studio/gradle/ folder, and extract it.
In Android Studio: File > Settings > Build, Execution > Gradle.
Select 'Use local gradle distribution' under 'Project-level settings'.
In 'Grade home', browse to the path of the downloaded gradle and select it.
OK > Sync project.
P.S. if local gradle is already selected, try reverse i.e. default wrapper.
Just clean and Rebuild the project. This worked for me