我添加到pubspec.yaml时,firebase auth出现问题

时间:2020-05-06 17:29:59

标签: android firebase flutter dart firebase-authentication

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

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

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

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

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

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

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

  • https://help.gradle.org

  • 获得更多帮助

1秒内失败

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

2 个答案:

答案 0 :(得分:0)

在gradle.properties中添加以下行

android.useAndroidX = true

答案 1 :(得分:0)

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
}