No cached version of com.android.tools.build:gradle:2.0.0 available for offline mode.

异常场景

从AS2.0升级到2.1,重新编译工程后,抛出了如下异常

Error:A problem occurred configuring root project 'AndroidStudioProjects'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:2.0.0.
     Required by:
         :AndroidStudioProjects:unspecified
      > No cached version of com.android.tools.build:gradle:2.0.0 available for offline mode.

分析

之前为了优化gradle的编译速度,选择了Offline Work模式,取消即可

解决

No cached version of com.android.tools.build:gradle:2.0.0 available for offline mode._第1张图片

Settings-Build.Execution,Deployment-Build Tools-Gradle–取消勾选的Offline Work, 重新编译,AS会自动下载.

你可能感兴趣的:(AndroidStudio手札)