【问题标题】:problem with firebase auth when i added to pubspec.yaml当我添加到 pubspec.yaml 时,firebase auth 出现问题
【发布时间】:2020-08-21 18:50:08
【问题描述】:

在为 x86 构建的 Android SDK 上以调试模式启动 lib\main.dart... 正在运行 Gradle 任务“assembleDebug”... 参数格式不正确-

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

在 13 秒内构建失败 构建失败可能是由于插件中的 AndroidX 不兼容。该工具即将尝试使用Jetfier解决不兼容问题。 构建插件 firebase_auth... 正在运行 Gradle 任务 'assembleAarRelease'...

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

  • 出了什么问题: 配置根项目“firebase_auth”时出现问题。

    未找到 SDK 位置。使用 local.properties 文件中的 sdk.dir 或使用 ANDROID_HOME 环境变量定义位置。

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

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

1 秒内构建失败

例外:由于上述问题,无法构建插件 firebase_auth。

【问题讨论】:

    标签: android firebase flutter dart firebase-authentication


    【解决方案1】:

    在 gradle.properties 中添加以下行

    android.useAndroidX=true

    【讨论】:

    • 你能把你的两个 build.gradle 文件都发到这里吗
    • 尝试将 gms 服务升级到 4.3.3,我认为是最新的。在再次运行应用程序之前使用flutter clean
    【解决方案2】:
    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.google.gms.google-services'
    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
    android {
        compileSdkVersion 28
    
        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }
    
        lintOptions {
            disable 'InvalidPackage'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "co.test.bubbleapp"
            minSdkVersion 21
            targetSdkVersion 28
            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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    
    }
    
    ___________________________________
    
    buildscript {
        ext.kotlin_version = '1.3.50'
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:3.2.1'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-14
      • 2021-08-09
      • 2020-04-06
      • 2018-03-15
      • 2019-12-03
      • 2019-01-12
      • 2021-08-19
      • 2020-12-01
      相关资源
      最近更新 更多