无法解析 com.google.guava:guava:30.1-jre - Gradle 项目同步失败。基本功能将无法正常工作 - 在 kotlin 项目中
Could not resolve com.google.guava:guava:30.1-jre - Gradle project sync failed. Basic functionality will not work properly - in kotlin project
以前是一个很好用的项目,更新后出现如下错误
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.retrofit_test"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
// implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.google.guava:guava:30.1-jre'
// implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30-M1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'android.arch.persistence.room:guava:1.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
如果我们需要更多的源代码来检查,我会更新它。
报错内容如下
配置根项目时出现问题 'Retrofit_Test'。
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.30/kotlin-gradle-plugin-1.5.30.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :
Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.32/kotlin-stdlib-jdk8-1.4.32.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-model:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find org.apache.httpcomponents:httpmime:4.5.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/apache/httpcomponents/httpmime/4.5.6/httpmime-4.5.6.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
Could not find commons-io:commons-io:2.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find org.ow2.asm:asm:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm/7.0/asm-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
Could not find org.ow2.asm:asm-analysis:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.ow2.asm:asm-commons:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find org.ow2.asm:asm-util:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find org.bouncycastle:bcpkix-jdk15on:1.56.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
Could not find org.glassfish.jaxb:jaxb-runtime:2.3.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.2/jaxb-runtime-2.3.2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find net.sf.jopt-simple:jopt-simple:4.9.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find com.squareup:javapoet:1.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/squareup/javapoet/1.10.0/javapoet-1.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find com.google.protobuf:protobuf-java:3.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aapt2-proto:7.0.2-7396180
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-device-provider-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2 > com.android.tools.analytics-library:protos:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
Could not find com.google.protobuf:protobuf-java-util:3.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java-util/3.10.0/protobuf-java-util-3.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
Could not find com.google.code.gson:gson:2.8.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find io.grpc:grpc-core:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-core/1.21.1/grpc-core-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-netty:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-netty/1.21.1/grpc-netty-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-protobuf:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-protobuf/1.21.1/grpc-protobuf-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-stub:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-stub/1.21.1/grpc-stub-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find com.google.crypto.tink:tink:1.3.0-rc2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/crypto/tink/tink/1.3.0-rc2/tink-1.3.0-rc2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find com.google.flatbuffers:flatbuffers-java:1.12.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc2/tensorflow-lite-metadata-0.1.0-rc2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.bouncycastle:bcprov-jdk15on:1.56.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
Could not find com.google.guava:guava:30.1-jre.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/guava/guava/30.1-jre/guava-30.1-jre.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-test-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
Could not find org.jetbrains.kotlin:kotlin-reflect:1.4.32.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-reflect/1.4.32/kotlin-reflect-1.4.32.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find javax.inject:javax.inject:1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/javax/inject/javax.inject/1/javax.inject-1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find net.sf.kxml:kxml2:2.3.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.layoutlib:layoutlib-api:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find org.jetbrains.intellij.deps:trove4j:1.0.20181211.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find xerces:xercesImpl:2.12.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/xerces/xercesImpl/2.12.0/xercesImpl-2.12.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find org.apache.commons:commons-compress:1.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/apache/commons/commons-compress/1.20/commons-compress-1.20.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
在构建脚本中添加mavenCentral()
repositories {
mavenCentral()
google()
}
添加存储库 mavenCentral() 如下 project-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
以前是一个很好用的项目,更新后出现如下错误
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.retrofit_test"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
// implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.google.guava:guava:30.1-jre'
// implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30-M1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'android.arch.persistence.room:guava:1.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
如果我们需要更多的源代码来检查,我会更新它。
报错内容如下
配置根项目时出现问题 'Retrofit_Test'。
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.30/kotlin-gradle-plugin-1.5.30.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :
Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.32/kotlin-stdlib-jdk8-1.4.32.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-model:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find org.apache.httpcomponents:httpmime:4.5.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/apache/httpcomponents/httpmime/4.5.6/httpmime-4.5.6.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
Could not find commons-io:commons-io:2.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find org.ow2.asm:asm:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm/7.0/asm-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
Could not find org.ow2.asm:asm-analysis:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.ow2.asm:asm-commons:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find org.ow2.asm:asm-util:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find org.bouncycastle:bcpkix-jdk15on:1.56.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
Could not find org.glassfish.jaxb:jaxb-runtime:2.3.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.2/jaxb-runtime-2.3.2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find net.sf.jopt-simple:jopt-simple:4.9.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find com.squareup:javapoet:1.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/squareup/javapoet/1.10.0/javapoet-1.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find com.google.protobuf:protobuf-java:3.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aapt2-proto:7.0.2-7396180
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-device-provider-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2 > com.android.tools.analytics-library:protos:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
Could not find com.google.protobuf:protobuf-java-util:3.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java-util/3.10.0/protobuf-java-util-3.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
Could not find com.google.code.gson:gson:2.8.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find io.grpc:grpc-core:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-core/1.21.1/grpc-core-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-netty:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-netty/1.21.1/grpc-netty-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-protobuf:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-protobuf/1.21.1/grpc-protobuf-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-stub:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-stub/1.21.1/grpc-stub-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find com.google.crypto.tink:tink:1.3.0-rc2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/crypto/tink/tink/1.3.0-rc2/tink-1.3.0-rc2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find com.google.flatbuffers:flatbuffers-java:1.12.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc2/tensorflow-lite-metadata-0.1.0-rc2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.bouncycastle:bcprov-jdk15on:1.56.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
Could not find com.google.guava:guava:30.1-jre.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/guava/guava/30.1-jre/guava-30.1-jre.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-test-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
Could not find org.jetbrains.kotlin:kotlin-reflect:1.4.32.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-reflect/1.4.32/kotlin-reflect-1.4.32.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find javax.inject:javax.inject:1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/javax/inject/javax.inject/1/javax.inject-1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find net.sf.kxml:kxml2:2.3.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.layoutlib:layoutlib-api:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find org.jetbrains.intellij.deps:trove4j:1.0.20181211.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find xerces:xercesImpl:2.12.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/xerces/xercesImpl/2.12.0/xercesImpl-2.12.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find org.apache.commons:commons-compress:1.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/apache/commons/commons-compress/1.20/commons-compress-1.20.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
在构建脚本中添加mavenCentral()
repositories {
mavenCentral()
google()
}
添加存储库 mavenCentral() 如下 project-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}