简体   繁体   English

Android studio 3.2.1 ArtifactResolveException:无法解析配置“:类路径”的所有工件

[英]Android studio 3.2.1 ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'

After I update Android Studio to 3.2.1 and gradle version in my project I am getting following build error.在我将项目中的 Android Studio 更新为 3.2.1 和 gradle 版本后,出现以下构建错误。

I have already checked lots of questions related this question but no luck.我已经检查了很多与此问题相关的问题,但没有运气。

Project dependency Build.gradle项目依赖 Build.gradle

buildscript {

    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        gradlePluginPortal()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        maven { url "https://jitpack.io" }
        jcenter ()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Error错误

org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'DemoAppppp'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:944)

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.2.1.
Required by:
    project :
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:103)
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:63)

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.2.1.
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:139)

Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
    at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
    at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)

Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
    at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:96)

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect 
Caused by: java.net.ConnectException: Connection refused: connect 

Update更新

I just followed @CoolMind answer it solve the gradle issue, but there is another issue comes which is This我只是跟着@CoolMind 回答它解决了 gradle 问题,但是还有另一个问题是这个

And I followed those answers which is given in this question but not solve my problem我遵循了这个问题中给出的答案,但没有解决我的问题

Just turn off the Toggle Offline Mode .只需关闭 Toggle Offline Mode 即可

On the top right side of the Window .在 Window 的右上角。

Click on Gradle 2nd number option(just near of Setting option) click on it then you will be able to do work continue sally.单击 Gradle 2nd number 选项(就在设置选项附近)单击它,然后您将能够继续工作。

As you can see the image如您所见

在此处输入图像描述

In The Right Side of the Android Studio, You can See Gradle option just click it and you will see a screen which is given below.在 Android Studio 的右侧,您可以看到 Gradle 选项,只需单击它,您将看到如下所示的屏幕。

Gradle can be offline. Gradle 可以离线。 If offline, you should do it online.如果离线,您应该在线进行。

截屏

In my case, I have added a dependency which is not available in any of the cloud repositpories.就我而言,我添加了一个在任何云存储库中都不可用的依赖项。 On removing dependency ,it started working消除依赖后,它开始工作

Check the below points.检查以下几点。

  1. Internet connectivity issue.互联网连接问题。
  2. Toggle Offline Mode.切换离线模式。

在此处输入图像描述

I had this problem also.我也有这个问题。 Tried all the suggestions, but didnt help.尝试了所有建议,但没有帮助。 The problem was in offline/online mode as other stated but you have to also check the compiler settings.如其他所述,问题出在离线/在线模式下,但您还必须检查编译器设置。 Make sure there is no --offline flag确保没有--offline标志

Preferences -> Build, Execution, Deployment -> Compiler首选项 -> 构建、执行、部署 -> 编译器

( Menubar 'File' button, 'Settings' menu option, 'Build, Execution, Deployment' menu twisty, 'Compiler' submenu ) (菜单栏“文件”按钮,“设置”菜单选项,“构建、执行、部署”菜单曲折,“编译器”子菜单)

On Command-line Options: --stacktrace在命令行选项上:--stacktrace

not不是

--offline --stacktrace --offline --stacktrace

Opening the "Gradle" side panel, and toggling the "online/offline" button to "online" worked for me as well.打开“Gradle”侧面板,并将“在线/离线”按钮切换到“在线”也对我有用。

Previous failed solution: I searched on Gradle's website for a manual download of version 3.6.3, but there wasn't one.上一个失败的解决方案:我在 Gradle 的网站上搜索了 3.6.3 版本的手动下载,但没有。 That number is the same version, however, of Android Studio being used.但是,该数字与所使用的 Android Studio 版本相同。

This problem appeared on OS X. After disabling web filtering application (some Google IPs were blocked) it disappeared.此问题出现在 OS X 上。禁用 Web 过滤应用程序(某些 Google IP 被阻止)后,它就消失了。 After syncing with gradle all files have been downloaded.与 gradle 同步后,所有文件都已下载。

Also you may set a checkbox like in https://discuss.gradle.org/t/android-studio-could-not-get-resource-https-dl-google-com-dl-android-maven2-com-android-tools-build-gradle-3-1-0-gradle-3-1-0-pom/26734 :您也可以设置一个复选框,如https://discuss.gradle.org/t/android-studio-could-not-get-resource-https-dl-google-com-dl-android-maven2-com-android-工具-build-gradle-3-1-0-gradle-3-1-0-pom/26734

Settings -> Build … -> Gradle -> Android Studio -> Enable embedded maven repository.设置 -> 构建... -> Gradle -> Android Studio -> 启用嵌入式 maven 存储库。

See also Could not resolve com.android.tools.build.gradle:3.0.1 .另请参阅无法解析 com.android.tools.build.gradle:3.0.1

If you have updated Gradle then most likely you will get this error because Gradle will be offline by default after updating.如果您更新了 Gradle,那么您很可能会收到此错误,因为更新后 Gradle 将默认离线。

Solution:解决方案:

In right hand side top corner click Gradle (Gradle panel or Gradle window opens).在右上角单击 Gradle(Gradle 面板或 Gradle 窗口打开)。 Connect Gradle to the internet by clicking the icon at the top of Gradle panel or window.通过单击 Gradle 面板或窗口顶部的图标将 Gradle 连接到 Internet。

This problem occurs when your android studio is not getting internet connection.当您的 android studio 无法连接互联网时,就会出现此问题。 You fix the internet, the problem fixes by itself.您修复互联网,问题自行解决。 To confirm the internet issue of the android studio you can attempt to login, update, connecting to firebase, etc all will fail.要确认 android studio 的 Internet 问题,您可以尝试登录、更新、连接到 Firebase 等,所有这些都将失败。

将项目升级到 androidx 更改编译到实现 将 v4 或 v7 更改为 androidx 依赖项

My problem was because a version was wrong in the dependencies in build.gradle (app).我的问题是因为 build.gradle (app) 中的依赖项中的版本错误。 If you have internet, it might be because of this, so try finding other warnings that might indicate a wrong dependency.如果您有互联网,可能是因为这个原因,因此请尝试查找其他可能指示错误依赖项的警告。

只是你必须打开切换按钮,进入窗口右侧的成绩菜单......所以你要进入在线模式......你必须有互联网连接才能......建立成绩......否则它会再次显示给你相同的错误或其他类型的错误...

对我来说,问题是需要更改组织的 Artifactory 密码才能使用新凭据更新 Gradle。

This Works 100%这工作 100%

turn off the Toggle Offline Mode .关闭切换离线模式。

Check the image below检查下面的图片

在此处输入图像描述

您可能添加了存储库中不可用的依赖项

This error may arrises due to "android:exported="false"".由于“android:exported="false"”,可能会出现此错误。 please make sure when to use "android:exported="true/false"".请确定何时使用“android:exported="true/false"”。

In my case none of the above helped.就我而言,以上都没有帮助。 I had to upgrade my FLIPPER_VERSION in my gradle.properties file.我必须在我的gradle.properties文件中升级我的 FLIPPER_VERSION。 You can find the latest FLIPPER_VERSION here: https://github.com/facebook/flipper/releases你可以在这里找到最新的 FLIPPER_VERSION: https ://github.com/facebook/flipper/releases

actually i ran into this problem.实际上我遇到了这个问题。 in my opinion error is due to version of libraries in file gradle.在我看来,错误是由于文件 gradle 中的库版本造成的。 you should change versions for this to work.您应该更改版本以使其正常工作。 this way was ok for me...这种方式对我来说没问题...

Deleting my.gradle file ("C:\Users<userName>.gradle") and going to the device manager and running "Cold Boot Now" fixed this problem for me删除 my.gradle 文件(“C:\Users<userName>.gradle”)并转到设备管理器并运行“立即冷启动”为我解决了这个问题

Try to Toggle Offline Mode , if not worked check your flipper version if it is old try to update it(worked for me).尝试切换离线模式,如果不起作用,请检查您的脚蹼版本是否旧,请尝试更新它(对我有用)。 Upgrading flipper version in gradle.propertiesgradle.properties中升级 flipper 版本

From

FLIPPER_VERSION=0.39.0

To

FLIPPER_VERSION=0.99.0

In my case I added maven repository in both repository section, so this issue occurs, So I removed this line from above repotories section inside buildscript for reference visit this answer https://stackoverflow.com/a/75005827/12748481在我的例子中,我在两个存储库部分都添加了 maven 存储库,所以出现了这个问题,所以我从上面的存储库部分中删除了这一行,以供参考,访问这个答案https://stackoverflow.com/a/75005827/12748481

我也遇到了同样的错误,因为当我更新我的 Android 工作室时,即使使用快速的互联网网络也无法启动一个新项目,但今天我发现了一个解决方案,只需点击你的事件日志并更新任何显示的建议插件重建你的项目,然后你的项目运行良好,它对我有用,相信它也对你有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio:无法解析配置“:classpath”的所有工件 - Android Studio:Could not resolve all artifacts for configuration ':classpath' Android Gradle 同步失败:无法解析配置“:classpath”的所有工件 - Android Gradle Sync failed: Could not resolve all artifacts for configuration ':classpath' Flutter:“无法解析配置&#39;:classpath&#39;的所有工件” - Flutter: "Could not resolve all artifacts for configuration ':classpath'" 无法解析配置“:classpath”的所有工件。 &gt; 无法解析 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 Android Studio 构建问题 - 无法解决配置的所有工件 - Android Studio building issues - Could not resolve all artifacts for configuration 无法在Android Studio上解析配置':classpath'的所有依赖项 - Could not resolve all dependencies for configuration ':classpath' on Android Studio “无法解析配置 ':classpath' 的所有文件。” android 工作室中的错误 - “Could not resolve all files for configuration ':classpath'.” error in android studio Android:找不到 jetifier 处理器库。 无法解析配置“:classpath”的所有工件 - Android: Could not find jetifier-processor library. Could not resolve all artifacts for configuration ':classpath' 无法解析配置 ':flutter_local_notifications:classpath' 的所有工件 - Could not resolve all artifacts for configuration ':flutter_local_notifications:classpath' Flutter:无法解析配置“:path_provider:classpath”的所有工件 - Flutter: Could not resolve all artifacts for configuration ':path_provider:classpath'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM