【Android Studio 踩坑日记】Could not resolve com.android.tools.build:aapt2:4.1.3-6503028.

问题描述

编译时遇到一个错误:
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':TestDemo:verifyReleaseResources'.

Could not resolve all files for configuration ':TestDemo:_internal_aapt2_binary'.
Could not resolve com.android.tools.build:aapt2:4.1.3-6503028.
Required by:
project :TestDemo
Could not resolve com.android.tools.build:aapt2:4.1.3-6503028.
Could not get resource 'https://maven.google.com/com/android/tools/build/aapt2/4.1.3-6503028/aapt2-4.1.3-6503028.pom'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.1.3-6503028/aapt2-4.1.3-6503028.pom'.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

  • 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 10s
37 actionable tasks: 4 executed, 33 up-to-date

解决方案:

    repositories {
        //maven {
        //    url 'https://maven.google.com/'
        //    name 'Google'
        //}
        //jcenter()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/repository/google' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        //maven {
        //    url 'https://maven.google.com/'
        //    name 'Google'
        //}
        //jcenter()
        //mavenCentral()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/repository/google' }
    }
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容