找不到design.jar(com.android.support:design:27.0.0)
每次我尝试构建apk时,它都会失败,并出现以下错误:找不到design.jar(com.android.support:design:27.0.0),android,android-gradle-plugin,Android,Android Gradle Plugin,每次我尝试构建apk时,它都会失败,并出现以下错误: > Could not find multidex.jar (com.android.support:multidex:1.0.2). Searched in the following locations: https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex-1.0.2.jar > Could not find desig
> Could not find multidex.jar (com.android.support:multidex:1.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex-1.0.2.jar
> Could not find design.jar (com.android.support:design:27.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/design/27.0.0/design-27.0.0.jar
> Could not find common.jar (android.arch.core:common:1.0.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.0.0/common-1.0.0.jar
我检查了机器,它工作正常
那么为什么它失败了呢
UPD
与前几天构建时使用的代码相同
这是项目级build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Android binaries) is installed from npm
url "$rootDir/reactnative/node_modules/react-native/android"
}
jcenter()
maven { url "https://jitpack.io" }
maven {url "https://clojars.org/repo/"}
maven { url "https://maven.google.com" }
mavenCentral()
}
}
com.android.support:design:27.0.0
在jcenter()
存储库中不可用,但在google()
存储库中可用。查看您的错误日志,看起来Android studio正在jcenter()
中查找它。要强制执行它,请查看google()
内部,将google()
作为您的第一条语句,或将其放置在jcenter()
上的两个存储库{..}
块中
repositories {
...
google()
jcenter()
...
}
你能用项目级build.gradle更新你的问题吗?用项目级build.gradle更新。你能把
jcenter()
作为repositories{}
和google()!如果你能给我解释一下,我将不胜感激。太好了!我在回答中提供了一些解释。我不知道为什么gradle不能搜索其他已声明的存储库,而只能搜索第一个存储库?@ThinkTwiceCode一旦我怀疑,jcenter()google()
有最新版本的库,因此可以正确解析。谢谢你救了我一天!