Failed to resolve:com.android.support:appcompat-v7:27.+ 问题的解决方法

版权声明:如果喜欢,就收藏吧 O(∩_∩)O~ https://blog.csdn.net/deniro_li/article/details/83684651

新建一个项目,出现 Failed to resolve:com.android.support:appcompat-v7:27.+ 问题:

1 分析

android studio 中的编译器版本与 build.gradle(app 下)不对应造成的。

打开 build.gradle 可以看到错误的编译器版本已被划上了红色波浪线:

2 解决

我们可以在 Project Structure → app → Dependenies 中看到编译器的版本号:

修改 build.gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    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:24.2.1'
    testCompile 'junit:junit:4.12'
}

最后点击顶部弹出框的 Sync Now 即可:

猜你喜欢

转载自blog.csdn.net/deniro_li/article/details/83684651