20

My project was working very fine, but until one day, when I uploaded my project to github. I don't know if this issue is related to that but today when I compiled my android studio project, it started showing me these 4 horrible errors. I have tried most of the google results but no help!

Error:Failed to resolve: com.android.support:cardview-v7:25.0.0
Error:Failed to resolve: com.android.support:customtabs:25.0.0
Error:Failed to resolve: com.android.support:appcompat-v7:25.0.0
Error:Failed to resolve: com.android.support:support-v4:25.0.0

This is the screenshot of android studio screen if it helps!

This is my app level build.gradle file:

apply plugin: 'com.android.application'

repositories {
    mavenLocal()
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    defaultConfig {
        applicationId "com.google.firebase.codelab.friendlychat"
        minSdkVersion 22
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:23.1.1'
    compile 'com.firebase:firebase-client-android:2.5.0'

    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.android.support:appcompat-v7:23.1.1'
    // Google
    compile 'com.google.android.gms:play-services-auth:9.4.0'
    // Firebase
    compile 'com.google.firebase:firebase-database:9.4.0'
    compile 'com.google.firebase:firebase-auth:9.4.0'
    compile 'com.google.firebase:firebase-config:9.4.0'
    compile 'com.google.android.gms:play-services-appinvite:9.4.0'
    compile 'com.google.firebase:firebase-messaging:9.4.0'
    compile 'com.google.android.gms:play-services-ads:9.4.0'
    compile 'com.google.firebase:firebase-database:9.2.1'
    compile 'com.google.firebase:firebase-messaging:9.2.1'
    compile 'com.google.firebase:firebase-crash:9.4.0'
    // Firebase UI
    compile 'com.firebaseui:firebase-ui-database:0.4.0'
    // Testing dependencies
    androidTestCompile 'junit:junit:4.12'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
    androidTestCompile 'com.android.support.test:runner:0.4.1'
    androidTestCompile 'com.android.support:support-annotations:23.4.0'


    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    //facebook
}

apply plugin: 'com.google.gms.google-services'

And this is my project level build.gradle file:

buildscript {
    repositories {
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.0.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenLocal()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Why I am starting to get these errors suddenly.
Thanks in advance!

sa77
  • 3,563
  • 3
  • 24
  • 37
rahul singhania
  • 237
  • 2
  • 11

7 Answers7

18

Open your android SDK manager (from C:\Users\youruseraccount\AppData\Local\Android\sdk) and update following to latest versions in,

Tools section section

  1. Android SDK Tool

  2. Android SDK Platform-Tools

  3. Android SDK Build tool

Android 7.1.1 (API 25) section

  1. SDK Platform

Extras Section

  1. Android Support Repository
  2. Android Support Library

Then update your gradle file accordingly.

Yogesh
  • 1,565
  • 1
  • 19
  • 46
14

Facebook updated their SDK to use the latest support libraries. You could replace

compile 'com.facebook.android:facebook-android-sdk:[4,5)'

with

compile 'com.facebook.android:facebook-android-sdk:4.16.1'

if you do not want to update your android sdk just yet.

Elias N
  • 1,430
  • 11
  • 19
4

I had the same problem earlier today. Out of nowhere, I started having those weird error messages. Updating:

  1. Android SDK Tool
  2. Android SDK Platform-Tools
  3. Android SDK Build tool
  4. Android Support Repository

did the trick for me. Just go to Tools > Android > SDK Manager in your Android Studio then find and update them. Good luck!

Oğuz Eroğlu
  • 103
  • 1
  • 9
3

If you try to remove facebook-sdk compile from dependencies will not show that error. So i think is facebook sdk error.

I was using 'com.facebook.android:facebook-android-sdk:[4,5)' but gives error, i tried this com.facebook.android:facebook-android-sdk:4.+ but is the same. But when i remove it app build successfully. Am i the only i came in this conclude and having the same problem ?

fpeposhi
  • 31
  • 5
2

if you are using cardview with 25.0.0 version then i think your issue is with your target sdk version. Make it 25 and things should work otherwise downgrade your cardview and other libraries from 25.0.0 to 23.x.x

Kunal Parikh
  • 463
  • 4
  • 15
0

Just updating the Android support repository version to 25 did my work. Thanks to all of you for the guidance!

rahul singhania
  • 237
  • 2
  • 11
0

If you added the latest Facebook SDK or using + for Facebook dependency, revert to a previous version

compile 'com.facebook.android:facebook-android-sdk:4.16.1'

Peter Ola
  • 132
  • 8