无法解决:com.android.support:support-v13:26 [英] Failed to resolve: com.android.support:support-v13:26

查看:103
本文介绍了无法解决:com.android.support:support-v13:26的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将TabLayout添加到.xml布局之前,一切都可以正常工作并编译良好.添加完之后,该项目只是拒绝编译,并且我所有的.xml文件都停止显示任何内容,并且我所有的库导入都说无法解析符号...".

Everything has been working and compiling fine until I've added a TabLayout to an .xml layout. After I added it, the project just refused to compile and either all of my .xml files stopped showing anything and all of my library imports say "cannot resolve symbol ...".

我不明白为什么以前一直编译良好的所有导入现在都只说:

I don't understand why all of my imports which had previously been compiling well now simply say:

无法解决:com.android.support:support-v13:26

Failed to resolve: com.android.support:support-v13:26

无法解决:com.android.support:appcompat-v7:26

Failed to resolve: com.android.support:appcompat-v7:26

,提供的按钮(例如安装存储库和同步项目")均不可单击.

and none of buttons provided (e.g. "Install repository and sync project") are clickable.

请查看gradle文件:

Please, have a look at the gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.prett.myapplication"
        minSdkVersion 22
        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'
        }
    }
    productFlavors {
    }
}

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:26'
    compile 'com.android.support:support-v13:26'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:25.3.1'
}

我尝试过使缓存无效/重新启动",但没有任何影响.

I've tried "Invalidate caches/restart", but it didn't have any impact.

P.S.

compile 'com.android.support:design:25.3.1'

此支持库不应使用与compileSdkVersion(26)不同的版本(25)

This support library should not use a different version (25) than the compileSdkVersion (26)

这也可能是导致问题的原因吗?

Could this also be causing the issue?

推荐答案

如果您的编译SDK版本为26,则android支持依赖项版本应为26.x.x

If your compile SDK version is 26, android support dependencies version should be 26.x.x

设置gradle依赖项如下:

Set your gradle dependencies as follow:

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:26.0.1'
    compile 'com.android.support:support-v13:26.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:26.0.1'
}

如果仍然出现编译错误,请将google maven存储库添加到Project Gradle文件:

If you still get compile errors, add google maven repository to Project Gradle file:

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
    }
}

这篇关于无法解决:com.android.support:support-v13:26的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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