Android Studio -> Preferences -> Gradle -> Tick Offline work and then restart your Android studio.
Reference screenshot: