找不到support-v4.aar(com.android.support:support-v4:24.1.1)

时间:2016-10-24 06:58:34

标签: java android android-studio gradle

该项目是Github上的Google样本之一Androidtv-Leanback。我克隆它并用Android studio打开,但构建失败。

错误:

  

找不到support-v4.aar(com.android.support:support-v4:24.1.1)

的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '24'
defaultConfig {
    applicationId "com.example.android.tvleanback"
    minSdkVersion 21
    targetSdkVersion 24
    versionCode 2
    versionName "1.3"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
 }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:leanback-v17:24.1.1'
compile 'com.android.support:recommendation:24.1.1'
compile 'com.android.support:preference-leanback-v17:24.1.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.robolectric:robolectric:3.1'
androidTestCompile 'com.android.support:support-annotations:24.1.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
compile 'com.google.android.exoplayer:exoplayer:r1.5.8'
//    compile files('src/libs/android-support-v4.jar')
}

1 个答案:

答案 0 :(得分:2)

在build.gradle文件中添加此依赖项

dependencies {
...
compile "com.android.support:support-v4:24.2.1"
}

并确保您已使用sdk manager下载了android支持存储库。