安装时发生gradle构建错误

时间:2017-10-07 10:41:35

标签: android android-gradle

我安装了Android Studio并创建了一个项目。这就是我所做的一切,创建一个项目并给它命名。

但是我收到以下错误消息:

C:\apps\sound\app\build.gradle
    Error:Error:line (28)Failed to resolve: junit:junit:4.12
<a href="openFile:C:/apps/sound/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Error:Error:Failed to resolve: javax.inject:javax.inject:1
<a href="openFile:C:/apps/sound/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Error:Error:Failed to resolve: javax.annotation:javax.annotation-api:1.2
<a href="openFile:C:/apps/sound/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Error:Error:Failed to resolve: com.google.code.findbugs:jsr305:2.0.1
<a href="openFile:C:/apps/sound/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Error:Error:Failed to resolve: org.hamcrest:hamcrest-library:1.3
<a href="openFile:C:/apps/sound/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Error:Error:Failed to resolve: org.hamcrest:hamcrest-integration:1.3
<a href="openFile:C:/apps/sound/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Error:Error:Failed to resolve: com.squareup:javawriter:2.1.1
<a href="openFile:C:/apps/sound/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

通过此处发布的类似问题,我尝试卸载并重新安装并以管理员身份运行Studio,但我得到了相同的结果。我也关掉了我的防火墙。

陷入第一道障碍!

建议赞赏

1 个答案:

答案 0 :(得分:0)

问题解决了。我卸载了AS,卸载了Java并删除了对注册表中java的引用。安装AS,一切都很好。因此,如果您遇到与我相同的问题,并且之前安装了Java,则可能是您的问题的根源。