Android studio 默认项目失败:Error:Failed to resolve: com.android.support:support-v4:25.2.0 [英] Android studio default project fails: Error:Failed to resolve: com.android.support:support-v4:25.2.0

查看:26
本文介绍了Android studio 默认项目失败:Error:Failed to resolve: com.android.support:support-v4:25.2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实际上只是第一次开始应用程序开发,当我创建一个新项目时,默认项目不会构建.我曾尝试在 Google 和 SO 上查找这些错误并找到了一些,但他们的解决方案不起作用.鉴于我根本没有编辑过这些文件,我认为这是 Android Studio 设置不正确但无法弄清楚的问题.错误如下:

I am literally just starting app development for the first time and the default project when I create a new one will not build. I have tried looking on Google and SO for these errors and have found some but their solutions do not work. Given that I have not edited the files at all, I presume it is an issue with Android Studio not being setup properly but can't figure it out. The errors are as follows:

Error:Failed to resolve: com.android.support:support-v4:25.2.0
Install Repository and sync project
Open File
Show in Project Structure dialog

Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Install Repository and sync project
Show in File
Show in Project Structure dialog

Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.+
Install Repository and sync project
Show in File
Show in Project Structure dialog

它指向的build.gradle文件如下:

The build.gradle file it points to is as follows:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.extremecomputing.spotzz"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.google.android.gms:play-services-maps:11.0.1'
    testCompile 'junit:junit:4.12'
}

我尝试过一个以前的项目,我创建了一些我在网上找到的东西.比如他们在版本中推荐的 + 可能会导致不可预测的构建,但事实并非如此.有人在 dependencies 部分推荐了几行编译行,它改变了一会儿说我需要下载一些东西的错误,然后我又回到了原来的错误.我还尝试确保 SDK 工具已更新,并且它们似乎已更新.任何建议将不胜感激.

I have tried with a previous project that I had created a few things I found online. Such as they had recommended the + in the version could cause unpredictable builds, but that wasn't it. One had recommended a few compile lines in the dependencies section, it changed the errors for a moment saying I needed to download something, I did then it went back to the original errors. I also have tried to make sure that the SDK tools are updated, and they appear to be. Any suggestions would be greatly appreciated.

推荐答案

试试这个:

  1. 在Android Studio中,打开Tools -> Android -> SDK Manager
  2. 在SDK 工具"选项卡下取消选中导致问题的库
  3. 点击应用"卸载它们
  4. 重新检查相同的库点击应用"重新安装它们
  5. 关闭 SDK Manager 并运行 Gradle 同步/构建

这篇关于Android studio 默认项目失败:Error:Failed to resolve: com.android.support:support-v4:25.2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆