失败:生成失败,出现异常。
- 错误:配置根项目“android”时出现问题。
无法解析配置“:classpath”的所有文件。找不到com.google.gms.google-services:4.4.0:。必需者:project:这是我的项目build.gradle文件
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms.google-services:4.4.0'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
字符串
这是我的app build.gradle文件
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'dev.flutter.flutter-gradle-plugin'
id 'com.google.gms.google-services'
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.example.learndart"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.learndart"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation(platform("com.google.firebase:firebase-bom:32.6.0"))
}
型
我已经厌倦了改变语法重新安装firebase看了一些教程,找出我一直在做错什么.告诉我我做错了什么,以及如何修复它的所有步骤,因为我仍然是新的这一点.
1条答案
按热度按时间af7jpaap1#
如果您已经下载并导入了google-services.json文件,请注意错误消息中的以下行
com.google.gms.google-services:4.4.0
在您的项目级build.gradle中字符串
将
com.google.gms.google-services:4.4.0
更改为com.google.gms:google-services:4.4.0
,如下所示型
注意gms后的".“改为”:“。
如果前面有apply,则应使用
'com.google.gms.google...'
,如果前面有classpath,则应使用'com.google.gms:google...'
清理和重建应用程序。