解决AndroidStudio编译出现available for offline mode的问题

异常全文

1
2
3
4
5
6
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not resolve com.squareup.okhttp3:okhttp:3.5.0.
Required by:
retrofit-rxjava-okhttp:app:unspecified > com.squareup.retrofit2:retrofit:2.1.0
> No cached version of com.squareup.okhttp3:okhttp:3.5.0 available for offline mode.

解决

截图是2.2的版本

Settings-Build.Execution,Deployment-Gradle–取消勾选的Offline Work,重新编译即可。