![](/img/trans.png)
[英]Gradle cannot find dependency that doesn't exist - 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.