我是 Android studio 的新手,我正在尝试建立一个新项目,但遇到以下错误消息:
Could not find com.android.tools.build:gradle:7.0.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.0.4/gradle-7.0.4.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.0.4/gradle-7.0.4.pom
Required by:
project :
Add google Maven repository and sync project
Open File
Run Code Online (Sandbox Code Playgroud)
我搜索了 Gradle 网站,发现我的 Android studio 默认设置的 7.0.4 在官方存储库中不存在。所以我下载了另一个版本(7.4.1)并更改了文件中的版本build.gradle,但没有解决问题。我使用该gradle-wrapper.properties文件下载了Gradle,但仍然无法运行。然后我尝试通过打开离线模式并更改位置来离线使用 gradle 插件file > settings > Build, Execution, Deployment > Build tools > Gradle,它向我显示了以下错误消息:
A problem occurred configuring root project 'My Application'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.4.1.
Required …Run Code Online (Sandbox Code Playgroud)