解决AndroidStudio编译出现"Could not resolve all files for configuration ':library:_internal_aapt2_binary'"

本文解决了一个常见的Android开发问题,即在使用Android Studio编译项目时遇到的Could not resolve all files for configuration ‘:library:_internal_aapt2_binary’错误。详细介绍了错误的原因在于缺少aapt2依赖,并提供了在Gradle中添加google()仓库来解决此问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

解决AndroidStudio编译出现"Could not resolve all files for configuration ‘:library:_internal_aapt2_binary’"问题

错误描述
FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':library:_internal_aapt2_binary'.
> Could not find com.android.tools.build:aapt2:3.2.0-4818971.
  Searched in the following locations:
      file:/E:/AndroidSdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
      file:/E:/AndroidSdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
      file:/E:/AndroidSdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
      file:/E:/AndroidSdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
      file:/E:/AndroidSdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
      file:/E:/AndroidSdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
      https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
      https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
  Required by:
      project :library

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
解决方法

再项目Gradleallprojects中添加google()如图:
在这里插入图片描述

评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值