找不到com.android.tools.build:aapt2 AndroidStudio

时间:2018-07-03 02:55:22

标签: java android android-studio

在尝试构建我的空libgdx android studio项目时收到此错误。

找不到com.android.tools.build:aapt2:3.2.0-alpha16-4748712。

在以下位置搜索:

file:/C:/Users/Noor~.~/android-sdks/extras/m2repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712.pom

file:/C:/Users/Noor~.~/android-sdks/extras/m2repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712-windows.jar

file:/C:/Users/Noor~.~/android-sdks/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712.pom

file:/C:/Users/Noor~.~/android-sdks/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712-windows.jar

file:/C:/Users/Noor~.~/android-sdks/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712.pom

file:/C:/Users/Noor~.~/android-sdks/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712-windows.jar

file:/C:/Users/Noor~.~/.m2/repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712.pom

file:/C:/Users/Noor~.~/.m2/repository/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712-windows.jar

https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712.pom

https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712-windows.jar

https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712.pom

https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712-windows.jar

https://oss.sonatype.org/content/repositories/releases/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712.pom

https://oss.sonatype.org/content/repositories/releases/com/android/tools/build/aapt2/3.2.0-alpha16-4748712/aapt2-3.2.0-alpha16-4748712-windows.jar

要求者:

project :android

2 个答案:

答案 0 :(得分:4)

您缺少对Google Maven的存储库依赖性。您需要编辑主build.gradle文件以包含:

buildscript {
    repositories {
        google() //This!
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-alpha16'
    }
}
allprojects {
    repositories {
        google() // And this!
        jcenter()
    }
}

答案 1 :(得分:0)

因此显然改变Gradle版本对我来说解决了这个问题。可以使用的Gradle版本是3.1.3,但我不确定为什么可以使用,或者是否适合所有人。