添加flutter_firebase_ui后flutter应用程序崩溃

Posted

技术标签:

【中文标题】添加flutter_firebase_ui后flutter应用程序崩溃【英文标题】:flutter app crashing after adding flutter_firebase_ui 【发布时间】:2019-07-29 08:54:46 【问题描述】:

当我添加这两个库时,我的应用无法运行,它只显示关闭应用对话框

image_picker: 0.4.12+1 #^0.5.0+3
flutter_firebase_ui: ^0.0.13

registerResGeneratingTask 已弃用,请使用 registerGeneratedResFolders(FileCollection) registerResGeneratingTask 已弃用,使用 registerGeneratedResFolders(FileCollection) registerResGeneratingTask 已弃用,请使用 registerGeneratedResFolders(FileCollection) registerResGeneratingTask 已弃用,使用 registerGeneratedResFolders(FileCollection) registerResGeneratingTask 已弃用,请使用 registerGeneratedResFolders(FileCollection) 内置 构建/app/outputs/apk/debug/app-debug.apk。颤振需要更长的时间 比预期报告其观点。还在努力……

删除flutter_firebase_ui: ^0.0.13 后,我的应用运行正常 但在我的另一个项目中,我使用的是flutter_firebase_ui: ^0.0.13 没有 image_picker: 0.4.12+1 #^0.5.0+3 并且它工作正常。 有什么问题?

Note: /home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.6/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.6/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/android/src/main/java/io/flutter/plugins/firebase/core/FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/midhilaj/.pub-cache/git/flutter_twitter_login-b28bcb56f7f86319a966dcf3a08543de358b1424/android/src/main/java/com/roughike/fluttertwitterlogin/fluttertwitterlogin/TwitterLoginPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

当我删除 flutter_firebase_ui: ^0.0.13 应用程序没有任何问题

 Launching lib/main.dart on Lenovo K8 Plus in debug mode...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:9: error: cannot find symbol
import androidx.annotation.NonNull;
                          ^
  symbol:   class NonNull
  location: package androidx.annotation
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:10: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:706: error: cannot find symbol
  private void reportException(Result result, @Nullable Exception exception) 
                                               ^
  symbol:   class Nullable
  location: class FirebaseAuthPlugin
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:610: error: cannot find symbol
    public void onComplete(@NonNull Task<AuthResult> task) 
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.SignInCompleteListener
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:629: error: cannot find symbol
    public void onComplete(@NonNull Task<Void> task) 
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.TaskVoidCompleteListener
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:647: error: cannot find symbol
    public void onComplete(@NonNull Task<SignInMethodQueryResult> task) 
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.GetSignInMethodsCompleteListener
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:187: error: cannot find symbol
                      public void onComplete(@NonNull Task<AuthResult> task) 
                                              ^
  symbol: class NonNull
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:492: error: cannot find symbol
              public void onComplete(@NonNull Task<GetTokenResult> task) 
                                      ^
  symbol: class NonNull
/home/midhilaj/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.1+4/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:559: error: cannot find symbol
          public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) 
                                          ^
  symbol: class NonNull
9 errors
         *********************************************************
WARNING: This version of firebase_auth will break your Android build if it or its dependencies aren't compatible with AndroidX.
         See "shorturl" for more information on the problem and how to fix it.
         This warning prints for all Android build failures. The real root cause of the error may be unrelated.
         *********************************************************

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_auth:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 2s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

【问题讨论】:

发布您在调试控制台中看到的错误/堆栈 等我更新 @user969068 调试控制台中没有显示任何内容,仅显示类应用程序对话框 【参考方案1】:

您需要选择与androidX兼容的版本 看这个链接:URL

你应该使用 firebase_auth: 0.7.0

【讨论】:

【参考方案2】:

通过在 AndroidManifest.xml 中添加 Facebook 应用程序 ID 解决了问题尝试使用 Android Studio 运行 Android 应用程序,您将收到错误消息

 <meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="adasdsa"/>

【讨论】:

这有帮助!即使您不使用 facebook 登录,也需要这样做,这似乎是库中的一个错误!

以上是关于添加flutter_firebase_ui后flutter应用程序崩溃的主要内容,如果未能解决你的问题,请参考以下文章

Flu epidemic in Guangdong, no need to panic, says expert

Flutter 添加到现有项目 (Android)

运行颤振医生后出错:无法找到Android SDK

fluent是啥意思

使用 MVC 和颤振颤振网站和应用程序如何连接后端?

选择不依赖于状态的正确颤振块小部件