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

2021-08-16 10:38:47 浏览数 (1)

异常场景

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

代码语言:javascript复制
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模式,取消即可

解决

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

0 人点赞