每次我试图构建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 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我检查了JCenter状态,它正常工作。
那为什么失败了?
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()
}
}发布于 2018-06-10 08:04:16
com.android.support:design:27.0.0不在jcenter()存储库中,而是在google()存储库中。看看您的错误日志,似乎Android正在试图在jcenter()中找到它。要强制它在google()内部查看,请将google()作为您的第一条语句,或者将其放在jcenter()之上的两个repositories{..}块中。
repositories {
...
google()
jcenter()
...
}https://stackoverflow.com/questions/50781629
复制相似问题