美文网首页
【Android Studio 踩坑日记】Could not r

【Android Studio 踩坑日记】Could not r

作者: 小马要加油 | 来源:发表于2022-02-28 14:47 被阅读0次

    问题描述

    编译时遇到一个错误:
    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' }
        }
    

    相关文章

      网友评论

          本文标题:【Android Studio 踩坑日记】Could not r

          本文链接:https://www.haomeiwen.com/subject/gzylrrtx.html