首页 > 解决方案 > 使用 Android Studio 启动一个新的 Android 项目

问题描述

我用 Android Studio 启动了一个新的 Android 项目并成为这个错误:

org.gradle.internal.resource.transport.http.HttpRequestException: Could not HEAD 'https://dl.google.com/dl/android/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom'.

标签: androidgradle

解决方案


在你的 build.gradle Module:app 上试试这个

configurations.all {
        resolutionStrategy {
            force 'org.hamcrest:hamcrest-core:1.3'
        }}

参考:https ://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html

让我知道这种方法是否有效。因为如果没有,那就没有更多的方法了。


推荐阅读