如何构建颤振gradle?它失败了

时间:2021-02-13 09:18:29

标签: android firebase flutter gradle flutter-dependencies

我将 firestore 和 firebase 身份验证添加到我的 Flutter 项目中,但现在它没有启动。

如果我在终端写 gradlew build,我会得到一个错误代码:

> Configure project :app
Adding a Configuration as a dependency is a confusing behavior which isn't recommended. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. If you're interested in inheriting the dependencies from the Configuration you are adding, you s
hould use Configuration#extendsFrom instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.artifacts.Configuration:extendsFrom(org.gradle.api.artifacts.Configuration[]) for more details.
        at build_90hb1guh6a6ptpmu6otfn4x4q$_run_closure3.doCall(D:\eyyup\AndroidStudioProjects\todo\android\build.gradle:27)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.destinationDir property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the destinationDirectory property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.
gradle.api.tasks.bundling.AbstractArchiveTask:destinationDir for more details.
        at FlutterPlugin$_addFlutterTasks_closure16$_closure35.doCall(D:\src\flutter\packages\flutter_tools\gradle\flutter.gradle:762)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveFileName property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.a
pi.tasks.bundling.AbstractArchiveTask:archiveName for more details.
        at FlutterPlugin$_addFlutterTasks_closure16$_closure35.doCall(D:\src\flutter\packages\flutter_tools\gradle\flutter.gradle:763)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

> Configure project :firebase_auth
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugAndroidTestCompileClasspath'.
   > Could not find com.google.firebase:firebase-analytics:.
     Required by:
         project :app

* 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 5s

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:0)

你记得更新你的 build.gradle 文件吗?或者您是否使用旧版本的 Flutter 创建了这个项目(在这种情况下,依赖项对于该版本的 Firebase Analytics 来说可能太旧了)。

检查您的 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'
     }
 }

并且您的 android/app/build.gradle 文件包含以下内容:

dependencies {
    def multidex_version = "2.0.1"
    implementation "androidx.multidex:multidex:$multidex_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
}
apply plugin: 'com.google.gms.google-services'

更多信息在这里https://github.com/FirebaseExtended/flutterfire/issues/2649#issuecomment-635855829

相关问题