Flutter Firebase错误(任务':app:mergeExtDexDebug'的执行失败)
我是编程新手,对flutter和firebase还是新手.我正在尝试使用此代码( https://github.com/tattwei46/flutter_login_demo ),但是我遇到了一个错误.一切都应该相同,只是我更改了google-service.json和GoogleService.plist使其与我的Firebase应用程序匹配,并且我编辑了home-page.dart.这是打印出来的内容:
I'm new to programming, and I'm very new to flutter and firebase. I'm experimenting with this code (https://github.com/tattwei46/flutter_login_demo), but I've run into an error. Everything should be the same except I changed the google-service.json and GoogleService.plist to match up with my firebase apps, and I edited home-page.dart. Here is what was printed out:
AGPBI:{:错误",文本":类型com.google.android.gms.common.internal.zzf被引用为来自 com.google.android.gms的接口.internal.zzcfb
.,"源:[{}],"工具:" D8}
AGPBI: {"kind":"error","text":"Type com.google.android.gms.common.internal.zzf is referenced as an interface from com.google.android.gms.internal.zzcfb
.","sources":[{}],"tool":"D8"}
失败:构建失败,并出现异常.
FAILURE: Build failed with an exception.
-
出了什么问题:任务':app:mergeExtDexDebug'的执行失败.
What went wrong: Execution failed for task ':app:mergeExtDexDebug'.
无法解析配置':app:debugRuntimeClasspath'的所有文件.无法转换工件'firebase-analytics-impl.aar(com.google.firebase:firebase-analytics-impl:11.4.2)'以匹配属性{artifactType = android-dex,dexing-enable-desugaring = true,dexing-is-debuggable = true,dexing-min-sdk = 16}.DexingWithClasspathTransform的执行失败:/Users/student/.gradle/caches/transforms-2/files-2.1/cfad2a10e4239993e5e793d023977752/jetified-firebase-analytics-impl-11.4.2/jars/classes.jar.删除时出错.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform artifact 'firebase-analytics-impl.aar (com.google.firebase:firebase-analytics-impl:11.4.2)' to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=16}. Execution failed for DexingWithClasspathTransform: /Users/student/.gradle/caches/transforms-2/files-2.1/cfad2a10e4239993e5e793d023977752/jetified-firebase-analytics-impl-11.4.2/jars/classes.jar. Error while dexing.
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.
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.
57秒内失败错误完成:Gradle任务assembleDebug失败,退出代码为1
BUILD FAILED in 57s Finished with error: Gradle task assembleDebug failed with exit code 1
是否有寻找解决方案和/或想法的东西?Flutter医生报告没有问题.
Any solutions and/or ideas for what to look for? Flutter doctor reports no issues.
在查看您的日志并在线搜索后,这里有一些可能的解决方法
After looking at your logs and online search here some potential fixes
1 使用类路径 com.google.gms:google-services:4.3.3
代替
classpath'com.google.gms:google-services:3.2.1
来自github问题 1494
classpath 'com.google.gms:google-services:3.2.1
from github issue 1494
2 更新您的 pubspec.yaml
,将项目迁移到AndroidX,启用multidex
2 update your pubspec.yaml
,
migrate the project to AndroidX,enable multidex