问题描述
编译时遇到一个错误:
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' }
}
网友评论