我一直试图在我的应用程序上设置Firebase,但遇到了一堵墙。
=错误在下面=
FAILURE:生成失败,出现异常。
- 其中:构建文件“C:\Users\Andre\FlutterDart\flutter_app_1\android\app\build.gradle”行:5
- 哪里出错了:解析插件[id:'com.google.gms. google-services',版本:'4.4.0',适用:假的]
无法满足此插件的请求,因为该插件已在类路径中,且版本未知,因此无法检查兼容性。
- 试试看:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。运行--扫描以获得完整的见解。
- 在https://help.gradle.org获取更多帮助
构建在1秒内失败
By 2 gradle文件如下:
android>app>build.gradle
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services" version '4.4.0' apply false
}
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.flutter_app_1"
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.flutter_app_1"
// 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.3.1')
implementation 'com.google.firebase:firebase-analytics-ktx'
}
android>build.grade
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.4.0'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
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
}
我不知道什么是错的,因为我只是按照firebase提供的说明。
我试着取下其中一个,看看是否有效。删除任何“com.google.gms.google-services”只会让它更糟糕。我试着从他们中的任何一个删除版本,看看是否只有1需要的版本,但没有。我没办法了。
1条答案
按热度按时间tjvv9vkg1#
我试着多弄弄它。这消除了错误,但仍然没有使其工作。至少有一个障碍已经被解决了XD
我删除了使其停止无法启动的版本。
终于成功了需要安装nodejs.org/en/原因:不知道。
然后,我需要安装flutterfire_jar。这需要相当多的工作,但我管理。终于成功了