方式一
View > Tool Windows > Gradle from the menu bar. Then, near the top of the Gradle window, click Toggle Offline Mode
方式二
直接打开Gradle视图,点击对应按钮即可,如下图所示:

参考
https://stackoverflow.com/questions/60481987/no-cached-version-gradle-plugin-available-for-offline-mode