报错信息

在这里插入图片描述

Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
   > Could not resolve com.android.tools.build:aapt2:3.5.1-5435860.
     Required by:
         project :app
      > No cached version of com.android.tools.build:aapt2:3.5.1-5435860 available for offline mode.
      > No cached version of com.android.tools.build:aapt2:3.5.1-5435860 available for offline mode.

Possible solution:
 - Disable offline mode and rerun the build
No cached version of com.android.tools.build:aapt2:3.5.1-5435860 available for offline mode.
Disable Gradle 'offline mode' and sync project

报错显示离线模式下找不到合适的tools缓存,请禁用gradle的offline mode,然后同步工程。

解决方法

打开侧边栏Gradle,点击offline mode,被选中有背影就是开启,否则就是关闭,我们需要保证它是关闭的。
在这里插入图片描述

再次sync,然后run,成功解决问题。
在这里插入图片描述

生活需要一颗感恩的心来创造, 一颗感恩的心需要生活来滋养。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐