找不到com.android.tools.build:aapt2:4.0.0-6051327 [英] Could not find com.android.tools.build:aapt2:4.0.0-6051327

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

问题描述

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

when I run a java file in android studio, this error happens:

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项目:

to give some information, build.gradle project:

// 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模块:

build.gradle Module:

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:

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:无法找到com.android.tools.build ,但问题仍然存在. Android Studion 4.0.我是android新手. 任何帮助都将受到高度赞赏...

I have tried Gradle Sync Failed: could not find com.android.tools.build, but the problem remains. android studion 4.0. I am new to android. any help is highly appreciated...

推荐答案

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

add google() dependency in your build.gradle file.

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

,并使用implementation代替compile,因为它已被弃用.

and use implementation instead of compile as it was deprecated.

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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆