2

The project is one of Google samples on Github, Androidtv-Leanback. I cloned it and opened with Android studio, but build fails.

Error:

Could not find 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')
}
ArK
  • 20,698
  • 67
  • 109
  • 136
helloliu
  • 115
  • 3
  • 15

1 Answers1

2

add this dependency in your build.gradle file

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

and make sure you have downloaded the android support repository using sdk manager.

shinilms
  • 1,494
  • 3
  • 22
  • 35
  • I do it as you say,but now saying `Error:A problem occurred configuring project ':app'. > Could not find support-v4.jar (com.android.support:support-v4:24.1.1). Searched in the following locations: https://jcenter.bintray.com/com/android/support/support-v4/24.1.1/support-v4-24.1.1.jar` – helloliu Oct 24 '16 at 07:47
  • add the dependency in your app\build.gradle file. refer this http://stackoverflow.com/a/23241888/5545429 – shinilms Oct 24 '16 at 07:52
  • I resolved the it by changing all the sdk version to from 24.1.1to 24.2.1.And thanks a lot ! – helloliu Oct 24 '16 at 08:23