无法解析配置“:classpath”的所有工件。 > 无法解析 com.android.tools.build:gradle:4.1.0
Posted
技术标签:
【中文标题】无法解析配置“:classpath”的所有工件。 > 无法解析 com.android.tools.build:gradle:4.1.0【英文标题】:Could not resolve all artifacts for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:4.1.0 【发布时间】:2021-06-04 01:35:53 【问题描述】:这个错误是突然出现的,在此之前几个月一切正常。
现在,即使创建一个新项目,不做任何修改也会产生同样的错误。
颤动运行->
Using hardware rendering with device sdk gphone x86 arm. If you notice graphics artifacts, consider enabling software
rendering with "--enable-software-rendering".
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:4.1.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.1.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.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
BUILD FAILED in 2s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 4.8s
Exception: Gradle task assembleDebug failed with exit code 1
应用级 build.gradle ->
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists())
localPropertiesFile.withReader('UTF-8') reader ->
localProperties.load(reader)
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null)
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null)
flutterVersionCode = '1'
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null)
flutterVersionName = '1.0'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android
compileSdkVersion 30
sourceSets
main.java.srcDirs += 'src/main/kotlin'
defaultConfig
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.utilapp"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
buildTypes
release
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
flutter
source '../..'
dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
项目级 build.gradle ->
buildscript
ext.kotlin_version = '1.3.50'
repositories
google()
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
allprojects
repositories
google()
jcenter()
rootProject.buildDir = '../build'
subprojects
project.buildDir = "$rootProject.buildDir/$project.name"
subprojects
project.evaluationDependsOn(':app')
task clean(type: Delete)
delete rootProject.buildDir
颤振医生->
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.1 20C69 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Xcode - develop for ios and macOS
! CocoaPods 1.7.5 out of date (1.10.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on
the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
【问题讨论】:
请阅读Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - 总结是这不是解决志愿者的理想方式,并且可能会适得其反。请不要将此添加到您的问题中。 好的,我明白了,但是您能提供一个解决方案吗? 我不是为Android开发的,但问题is almost certainly a duplicate。 您找到解决方案了吗?请这是紧急的 【参考方案1】:检查您的互联网连接。当连接突然断开时,我出现了这个错误。
【讨论】:
以上是关于无法解析配置“:classpath”的所有工件。 > 无法解析 com.android.tools.build:gradle:4.1.0的主要内容,如果未能解决你的问题,请参考以下文章
无法解析配置“:classpath”的所有工件。无法解析 org.jetbrains.kotlin:kotlin-reflect:1.2.71
无法解析配置“:classpath”的所有工件。 > 无法解析 com.android.tools.build:gradle:4.1.0
离子科尔多瓦构建错误无法解析配置':classpath'的所有工件无法下载com.android.tools.build:builder:3.3.0
Flutter Run 无法解析配置“:classpath”的所有工件。找不到com.android.tools.build::4.1.0