【问题标题】:Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:25.+错误:(26, 13) 无法解决:com.android.support:appcompat-v7:25.+
【发布时间】:2017-06-23 05:07:33
【问题描述】:

当我在 android studio 2.3.3 中构建一个项目(简单的 helloworld 应用程序)时,我面临着gradle error。我在此处附上了描述我面临的错误消息的屏幕截图。请帮助我如何摆脱它?

注意 - 请告诉我要添加哪些代码文件以消除此类错误。

我的 build.gradle:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.1'

       }
}

allprojects {
repositories {
    jcenter()
}
}

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

【问题讨论】:

  • 显示代码中产生错误的部分并详细描述错误

标签: android android-studio android-gradle-plugin android-support-library gradle-dependencies


【解决方案1】:

看你的问题标题,Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:25.+

不要使用带有 + 符号的那种版本,因为 AS 将继续检查与这种声明相关联的库的任何新版本。使用稳定版,截至 2017 年 6 月的 25.4.0。

如果您不确定哪个版本稳定,请前往此处, https://developer.android.com/topic/libraries/support-library/revisions.html

【讨论】:

    【解决方案2】:

    只需转到您的项目结构,然后在 Gradle 脚本> build.gradle(Module:app)

    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:25.0.1'
        //not like com.android.support:appcompat-v7:25.+
        testCompile 'junit:junit:4.12'
    }
    

    还有更新版本的 appcompat 提示出现在您的状态栏下方,请使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-03
      • 2017-01-04
      相关资源
      最近更新 更多