Android Gradle build project takes forever


Example

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

Reference screenshot:

enter image description here