无法解析Android支持库

时间:2016-06-14 08:52:33

标签: android android-support-library android-design-library

更新Android Studio后,Android设计库已解决,但Android支持库未解析。

enter image description here

Gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.abc.testapp"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:23.3.0'
}

我正在使用Android Studio 2.1.2

修改

这很奇怪,因为支持库的v4和v7版本都包含在设计库的依赖项中

\--- com.android.support:design:23.3.0                                                         
     +--- com.android.support:appcompat-v7:23.3.0
     |    +--- com.android.support:support-vector-drawable:23.3.0
     |    |    \--- com.android.support:support-v4:23.3.0
     |    |         \--- com.android.support:support-annotations:23.3.0
     |    +--- com.android.support:animated-vector-drawable:23.3.0
     |    |    \--- com.android.support:support-vector-drawable:23.3.0 (*)
     |    \--- com.android.support:support-v4:23.3.0 (*)
     +--- com.android.support:support-v4:23.3.0 (*)
     \--- com.android.support:recyclerview-v7:23.3.0
          +--- com.android.support:support-v4:23.3.0 (*)
          \--- com.android.support:support-annotations:23.3.0

更新

当我运行命令' gradew app:dependencies '为了获得项目依赖性,Android Studio下载了很多' .pom'显示结果之前的文件。

Download https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.2/gradle-2.1.2.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.1.2/gradle-core-2.1.2.pom     
Download https://jcenter.bintray.com/com/android/tools/build/builder/2.1.2/builder-2.1.2.pom             
Download https://jcenter.bintray.com/com/android/tools/lint/lint/25.1.2/lint-25.1.2.pom                  
Download https://jcenter.bintray.com/com/android/tools/build/gradle-api/2.1.2/gradle-api-2.1.2.pom       
Download https://jcenter.bintray.com/com/android/databinding/compilerCommon/2.1.2/compilerCommon-2.1.2.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/2.1.2/builder-model-2.1.2.pom 
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/2.1.2/builder-test-api-2.1.2.pom
Download https://jcenter.bintray.com/com/android/tools/sdklib/25.1.2/sdklib-25.1.2.pom                   
Download https://jcenter.bintray.com/com/android/tools/sdk-common/25.1.2/sdk-common-25.1.2.pom           
Download https://jcenter.bintray.com/com/android/tools/common/25.1.2/common-25.1.2.pom                   
Download https://jcenter.bintray.com/com/android/tools/build/manifest-merger/25.1.2/manifest-merger-25.1.2.pom
Download https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/25.1.2/ddmlib-25.1.2.pom              
Download https://jcenter.bintray.com/com/android/tools/lint/lint-checks/25.1.2/lint-checks-25.1.2.pom    
Download https://jcenter.bintray.com/com/android/tools/annotations/25.1.2/annotations-25.1.2.pom         
Download https://jcenter.bintray.com/com/android/databinding/baseLibrary/2.1.2/baseLibrary-2.1.2.pom     
Download https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/25.1.2/layoutlib-api-25.1.2.pom
Download https://jcenter.bintray.com/com/android/tools/dvlib/25.1.2/dvlib-25.1.2.pom                     
Download https://jcenter.bintray.com/com/android/tools/repository/25.1.2/repository-25.1.2.pom           
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/25.1.2/lint-api-25.1.2.pom

但在此之后问题得到了解决,并且使用现有的gradle文件构建成功。

是否有人可以了解背景中可能发生的事情?

2 个答案:

答案 0 :(得分:0)

遵循两个步骤:

<强> 1。首先从SDK管理器更新您的支持库:

enter image description here

<强> 2。在Build gradle中添加以下依赖项:

compile "com.android.support:support-v4:23.2.0"
compile "com.android.support:appcompat-v7:23.2.0"

答案 1 :(得分:0)

尝试将SDK管理器上的Android支持库升级到最新版本。