提问人:Daniel Sogbey 提问时间:10/17/2021 最后编辑:Martin ZeitlerDaniel Sogbey 更新时间:11/15/2023 访问量:3405
将 com.google.gms:google-services:4.3.10 作为类路径添加到项目 build.gradle 文件后,下载 com.google.gms:google-services:4.3.10 时出现问题
Problem downloading com.google.gms:google-services:4.3.10 after adding it as a classpath to the project build.gradle file
问:
尝试将我的应用程序连接到 firebase 后,我开始收到此错误。
这是我在gradle构建后收到的错误消息
无法获得“https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.10/google-services-4.3.10.pom”。从服务器收到状态代码 405:不允许的方法
项目 build.gradle 文件内容
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle 文件内容
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.gms.google-services'
}
//apply plugin: 'com.google.gms.google-services'
android {
compileSdk 31
defaultConfig {
applicationId "com.daniel_sogbey.marmap"
minSdk 21
targetSdk 31
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'
}
buildToolsVersion '31.0.0'
}
dependencies {
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.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation platform('com.google.firebase:firebase-bom:28.4.2')
implementation 'com.google.firebase:firebase-analytics-ktx'
}
googleServices { disableVersionCheck = true }
答:
1赞
Simon Raes
10/19/2021
#1
您的 Gradle 文件看起来不错,但您的系统似乎无法联系 Google 代码库。
确保您没有运行阻止访问的防火墙。
评论
0赞
CS QGB
6/7/2023
无法解析配置“:app:debugRuntimeClasspath”的所有依赖项。无法创建任务“:app:minifyDebugWithR8”。无法查询此提供程序的值,因为它没有可用的值。
评论