42

I am trying to use the support libraries of version 25.2.0 so I will be able to use the CameraKit library.

I have got the newest build tools downloaded:

enter image description here

and the support repository: enter image description here

my gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.sample.myapp"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    maven {
        url "https://jitpack.io"
    }
    mavenCentral()
}

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'
    })
    testCompile 'junit:junit:4.12'

    // Google libraries
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.google.android.gms:play-services-vision:10.0.1'
    compile 'com.android.volley:volley:1.0.0'

    // Third party libraries
    compile 'com.flurgle:camerakit:0.9.17'

    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.android.support:cardview-v7:25.2.0'
}

Problem: For each support-library I get the issue:

Failed to resolve com.android.support:cardview-v7:25.2.0

If I try to click on Install repository and sync project nothing happens.

enter image description here

I have followed that gradle file as an example. Were could be my mistake?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
jublikon
  • 3,427
  • 10
  • 44
  • 82
  • 1
    Update support repository also – IntelliJ Amiya Apr 19 '17 at 12:20
  • When you click on "Install Repository and sync project", what happens? – CommonsWare Apr 19 '17 at 12:28
  • 1
    @CommonsWare nothing. When the mouse pointer is over the link it changes to indicate that there is a clickable link. After clicking nothing happens. I have tried **File -> Infalidate caches / Restart**. Unfortunately that did not help – jublikon Apr 19 '17 at 12:31
  • If you scroll down in the SDK Tools tab (shown in your question), you should see an entry for Android Repository. Does it show that you have the latest version? – CommonsWare Apr 19 '17 at 12:36
  • Android Support Repository is downloaded for version 47.0.0? I have added a screenshot to my post. – jublikon Apr 19 '17 at 12:41
  • I had the same problem with support lib "appcompat-v7:25.4.0", latest at the time of this comment, it dint work for some reason, so I reverted back to a older version "appcompat-v7:25.0.0", you can find the older versions here https://developer.android.com/topic/libraries/support-library/revisions.html – Azzy Jul 07 '17 at 12:12

4 Answers4

60

Previously the Android Support Library dependencies were downloaded from Android SDK Manager.

Now all the new versions are available from Google's Maven repository. In future all android libraries will be distributed through maven.google.com

So, by adding the below code to the repositories will build the project.

repositories {
    maven {
        url "https://maven.google.com"
    }
}
KaMyLL
  • 969
  • 1
  • 7
  • 13
43

I had to add the following to my project level build.gradle. Then the button to install and worked.

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Justin
  • 3,322
  • 2
  • 22
  • 37
29

Try using the latest support library versions:

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile 'com.android.volley:volley:1.0.0'
// Third party libraries
compile 'com.flurgle:camerakit:0.9.17'

compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'

here is the detail Dependencies

EDIT

Use Google Maven Repository

To add them to your build, you need to first include Google's Maven repository in your top-level build.gradle file:

Project -- build.gradle (Not app build.gradle)

 allprojects {
    repositories {
        // If you're using a version of Gradle lower than 4.1, you must instead use:
        maven {
            url 'https://maven.google.com'
        }
        // An alternative URL is 'https://dl.google.com/dl/android/maven2/'

       jcenter()
    }
}
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62
15

Make sure to put it under allprojects! My mistake was to put it under buildscript.

DON'T DO THIS:

buildscript {
    repositories {
        jcenter()
         maven {
             url 'https://maven.google.com' //don't put it here
         }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

BUT INSTEAD DO THIS:

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com' //put it here
        }
    }
}
Mr-IDE
  • 7,051
  • 1
  • 53
  • 59