Adnan Mulla
Adnan Mulla

Reputation: 2866

Gradle doesn't find dependency - Android Studio

Gradle no longer finds dependencies declared in the build.gradle. Everything was working fine and today when I open Android Studio I get an error :

 Error:Failed to find: com.readystatesoftware.systembartint:systembartint:1.0.3

The library referenced is SystemBarTint. I had the library work previously using the same build.gradle file but now it no longer works.

My app/build.gradle looks like this :

 apply plugin: 'com.android.application'

 android {
     compileSdkVersion 19
     buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.adnan.systembartintdemo"
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
 }

 dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])

     compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
}

My root/build.gradle looks like this :

  buildscript {
          repositories {
                jcenter()
                mavenCentral()
          }

          dependencies {
                 classpath 'com.android.tools.build:gradle:0.12.+'

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

 allprojects {
      repositories {
            jcenter()
            mavenCentral()
      }
}

Any ideas what I am doing wrong here? Thanks !

Edit : Tried importing a project which I work on daily at my work, it fails to find any dependencies in that project either. Tried re installing Android Studio, still the same error

Upvotes: 1

Views: 3866

Answers (1)

Adnan Mulla
Adnan Mulla

Reputation: 2866

Ok finally got this fixed.The problem was weird, for some reason it was trying to pick up a local offline copy of the dependency, I went to Settings -> Compiler -> Gradle -> Enabled offline Work and disabled it again. Save and Apply changes.

And now it works !

Upvotes: 6

Related Questions