gpt4 book ai didi

android - 找不到 com.android.tools.build :aapt2:4. 0.0-6051327

转载 作者:行者123 更新时间:2023-12-03 15:15:37 31 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Could not find com.android.tools.build:aapt2:3.2.0

(17 个回答)


2年前关闭。




当我在 android studio 中运行 java 文件时,会发生此错误:

Could not find com.android.tools.build:aapt2:4.0.0-6051327.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/aapt2/4.0.0-6051327/aapt2-4.0.0-6051327.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :objects

提供一些信息,
build.gradle 项目:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'

}
}

allprojects {
repositories {
jcenter()
}
}

build.gradle 模块:
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "20.0.0"

defaultConfig {
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

}

gradle-wrapper.properties:
#Tue Jun 16 10:43:56 IRDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

我试过 Gradle Sync Failed: could not find com.android.tools.build ,但问题依然存在。安卓工作室 4.0.我是安卓新手。
任何帮助都非常感谢...

最佳答案

添加 google() build.gradle 文件中的依赖项。

allprojects {
repositories {
google() // this one is missing in your code
jcenter()
}
}

并使用 implementation而不是 compile因为它已被弃用。

关于android - 找不到 com.android.tools.build :aapt2:4. 0.0-6051327,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62402471/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com