问题描述
这是发生异常的地方:
@override
Future<FirebaseUser> getCurrentUser() async {
FirebaseUser user = await _firebaseAuth.currentUser();
return user;
}
确切的错误是:
Exception has occurred.
PlatformException (PlatformException(error, FirebaseApp with name [DEFAULT] doesn't exist. , null))
我的Flutter Doctor输出:
My Flutter Doctor Output:
[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
• Flutter version 1.12.13+hotfix.5 at D:\src\flutter
• Framework revision 27321ebbad (7 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\jcdos\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.5)
• Android Studio at D:\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
exit code 0
这是我的调试控制台:
E/flutter ( 6562): #40 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5445
E/flutter ( 6562): #41 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3194
E/flutter ( 6562): #42 Element.updateChild
package:flutter/…/widgets/framework.dart:2988
E/flutter ( 6562): #43 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter ( 6562): #44 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter ( 6562): #
√ Built build\app\outputs\apk\debug\app-debug.apk.
我已经尝试寻找其他来源来修复该错误,但是没有任何效果.我从应用程序gradle中删除了应用插件:"com.google.gms.google-services",因为这导致了其他问题.并删除了此问题,正如我发现的消息灵通所说的那样,它已经在其他地方被调用了.
I've tried finding other sources to fix the error, but nothing works. I removed apply plugin: 'com.google.gms.google-services' from the app gradle as that was causing me other issues. And removing this fixed it, as the source I found said it gets called already somewhere else.
如果我保留com.google.gms.google-services,则会收到此错误,这会阻止该应用程序同时在模拟器中运行:
And if I keep the com.google.gms.google-services then I get this error which prevents the app from running in the emulator all together:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'com.example.testapp
推荐答案
将以下行添加到您的android/app/build.gradle文件中:
Add below line into your android/app/build.gradle file:
apply plugin: 'com.google.gms.google-services'
这篇关于如何解决异常错误:名称为[DEFAULT]的FirebaseApp不存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!