簡體   English   中英

Gradle找不到依賴項-Android Studio

[英]Gradle doesn't find dependency - Android Studio

Gradle不再找到在build.gradle中聲明的依賴項。 一切運行正常,今天打開Android Studio時出現錯誤:

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

引用的庫是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'
}

我的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()
      }
}

有什么想法我在這里做錯了嗎? 謝謝 !

編輯:試圖導入一個我每天在工作的項目,它也找不到該項目中的任何依賴項。 嘗試重新安裝Android Studio,仍然出現相同的錯誤

好的終於解決了。問題很奇怪,由於某種原因,它試圖獲取依賴項的本地脫機副本,我去了設置->編譯器-> Gradle->啟用離線工作並再次禁用它。 保存並應用更改

現在就可以了!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM