Gradle没有找到依赖项 - Android Studio

Adn*_*lla 0 android android-studio android-gradle-plugin

Gradle不再查找build.gradle中声明的依赖项.一切都很好,今天当我打开Android Studio时出现错误:

 Error:Failed to find: com.readystatesoftware.systembartint:systembartint:1.0.3
Run Code Online (Sandbox Code Playgroud)

引用的库是SystemBarTint.我以前使用相同的build.gradle文件工作,但现在它不再有效.

我的app/build.gradle看起来像这样:

 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'
}
Run Code Online (Sandbox Code Playgroud)

我的root/build.gradle看起来像这样:

  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()
      }
}
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么想法?谢谢 !

编辑:尝试导入我在工作中每天工作的项目,它也无法在该项目中找到任何依赖项.尝试重新安装Android Studio,仍然是同样的错误

Adn*_*lla 5

好吧终于解决了这个问题.问题很奇怪,出于某种原因,它试图获取依赖项的本地脱机副本,我转到设置 - >编译器 - > Gradle - >启用离线工作并再次禁用它.保存并应用更改.

现在它有效!