本文介绍了找不到com.android.tools.build:aapt2:3.2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AndroidStudio3.2 Canary14清理和重建失败,并出现以下错误

AndroidStudio3.2 Canary14 fails clean-and-rebuild with the following error

Could not find com.android.tools.build:aapt2:3.2.0-alpha14-4748712.
Searched in the following locations:
    file:~/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712.pom
    file:~/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712-osx.jar
    file:~/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712.pom
    file:~/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712-osx.jar
    file:~/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712.pom
    file:~/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712-osx.jar
    https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712.pom
    https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-alpha14-4748712/aapt2-3.2.0-alpha14-4748712-osx.jar
Required by:
    project :app

推荐答案

要使用AAPT2,请确保您的build.gradle文件中具有google()依赖项,如下所示:

To use AAPT2, make sure that you have a google() dependency in your build.gradle file, as shown here:

buildscript {
  repositories {
      google() // here
      jcenter()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:3.2.0-alpha12'
  }
}
allprojects {
  repositories {
      google() // and here
      jcenter()
  }
}

buildscript中添加存储库是不够的,您还需要在allprojects中添加它.

Adding the repositories in the buildscript is not sufficient, you need to add it also in allprojects.

来源: https://developer.android.com/studio/releases/#aapt2_gmaven

这篇关于找不到com.android.tools.build:aapt2:3.2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 10:27