【问题标题】:im stuck with firebase authetication我坚持使用 Firebase 身份验证
【发布时间】:2021-08-04 18:30:43
【问题描述】:

我正在尝试将 firebase 连接到我的颤振项目中,经过大量研究,我仍然不知道这个错误。我正在尝试连接身份验证,按照教程一步一步来,但它似乎不起作用

有人请帮助我:V,我只有 1.5 个月了。 (顺便说一句,如果stackoverflow,我不知道如何发布正确的版本,我很抱歉)

这里,写在控制台里

FAILURE:构建失败并出现异常。

  • 在哪里: 构建文件 'C:\Flutter_Project\firebase_authentication\android\build.gradle' 行:25

  • 出了什么问题: 评估根项目“android”时出现问题。

配置项目“:app”时出现问题。 org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException:在 com.google.gms.googleservices.GoogleServicesTask 类型的任务 ':app:processDebugGoogleServices' 上找不到参数 [debug] 的方法 setVariantDir()。

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

在 1 秒内构建失败 异常:Gradle 任务 assembleDebug 失败,退出代码为 1


这个问题出现了

(-) 无法解析符号“属性”
(-) throw new GradleException("未找到 Flutter SDK。在 local.properties 文件中使用 flutter.sdk 定义位置。")

这是 build.gradle 的代码

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'   // this is line 25
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 30

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.firebase_authentication"
        minSdkVersion 16
        targetSdkVersion 30
        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 {
    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:28.0.0')

    // Add the dependency for the Firebase SDK for Google Analytics
    // When using the BoM, don't specify versions in Firebase dependencies
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-firestore'

    // Add the dependencies for any other desired Firebase products
    // https://firebase.google.com/docs/android/setup#available-libraries
}

请善良的人

【问题讨论】:

    标签: android firebase flutter authentication gradle


    【解决方案1】:

    先尝试flutter clean,好像机器找不到你的flutter.sdk

    您是否将文件从 firebase google-services.json 放到文件夹 android/app 文件夹中?

    还添加了 firebase 的依赖项?在文件 build.grandle 但不是在 android/app 文件夹中

    buildscript {
    repositories {
        google()
        jcenter()
    }
    
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.3.5'
    }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-18
      • 1970-01-01
      • 1970-01-01
      • 2017-10-06
      • 1970-01-01
      • 1970-01-01
      • 2017-01-30
      • 1970-01-01
      相关资源
      最近更新 更多