0

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

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

我的 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
}
4

2 回答 2

0

只需转到您的项目结构,然后在Gradle Scripts > 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 提示也会出现在您的状态栏下,请使用它。

于 2017-07-04T16:54:32.033 回答
0

查看您的问题标题,错误:(26、13)无法解决:com.android.support:appcompat-v7:25.+

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

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

于 2017-07-04T16:41:53.777 回答