【问题标题】:Error: A problem occurred configuring project ':firebase_auth_web'错误:配置项目“:firebase_auth_web”时出现问题
【发布时间】:2021-01-09 09:57:32
【问题描述】:

所以当我遇到这个错误时,我只是想在我的应用中实现谷歌登录功能

全文如下:

FAILURE: Build failed with an exception.

* Where:
Script 'E:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 362

* What went wrong:
A problem occurred configuring project ':firebase_auth_web'.
> Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Finished with error: Gradle task assembleDebug failed with exit code 1

我做过的事情:-

1.我已经在依赖项中添加了需要的插件

dependencies:
  google_sign_in: ^4.5.3
  firebase_auth: ^0.18.0+1

2.我的flutter是最新的。

我的 android/build.gradle 文件

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:4.3.3'
    }
}

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
}

我的 app/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'
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 "com.example.memesgram23"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    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"
    implementation 'com.google.firebase:firebase-analytics:17.5.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

Stackoverflow 告诉我该帖子主要包含代码,因此我添加了这一行以便平衡。我不知道我可以添加哪些细节我认为 stackoverflow 应该对这个算法有所了解。

【问题讨论】:

  • 添加你的 build.gradle 文件
  • @PeterHaddad 我应该在哪里添加它。(我是 Stackoverflow 的新手)。
  • 到问题,只需从android studio复制并编辑您的问题并粘贴
  • 同时添加 app/build.gradle

标签: firebase flutter dart mobile-application android-studio-4.0


【解决方案1】:

minSdkVersion 升级为以下:

 minSdkVersion 23

还将firebase_core 添加到pubspec.yaml 文件中:

firebase_core: ^0.5.0

【讨论】:

  • 如何升级mini sdk版本?
  • 在 app/build.gradle 里改一下
  • 同样的错误!我刚刚将文本从 16 更改为 23 还有什么?
  • 你添加了 firebase_core 并保存了吗?关闭ide,再次打开并重新运行
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-10-07
  • 2020-11-23
  • 1970-01-01
  • 2022-12-17
  • 2021-04-09
  • 2021-05-29
  • 2021-10-26
相关资源
最近更新 更多