firebase_auth:^ 0.11.1 + 7依赖关系使我的Flutter应用程序崩溃

时间:2019-06-23 15:36:30

标签: firebase flutter firebase-authentication

我正在开发一款Flutter应用程序。

我添加以下依赖项:

firebase_auth: ^0.11.1+7

当我尝试运行该应用程序时,它会崩溃。

我有flutter的最新版本,而firebase_auth的版本是最新的。

我还没有向flutter应用程序添加其他依赖项。

这是例外:

C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\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
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\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
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:764: error: cannot find symbol
  private void reportException(Result result, @Nullable Exception exception) {
                                               ^
  symbol:   class Nullable
  location: class FirebaseAuthPlugin
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:668: error: cannot find symbol
    public void onComplete(@NonNull Task<AuthResult> task) {
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.SignInCompleteListener
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:687: error: cannot find symbol
    public void onComplete(@NonNull Task<Void> task) {
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.TaskVoidCompleteListener
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:705: error: cannot find symbol
    public void onComplete(@NonNull Task<SignInMethodQueryResult> task) {
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.GetSignInMethodsCompleteListener
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:540: error: cannot find symbol
              public void onComplete(@NonNull Task<GetTokenResult> task) {
                                      ^
  symbol: class NonNull
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.11.1+7\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:617: error: cannot find symbol
          public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                                          ^
  symbol: class NonNull
8 errors

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 17s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See url for more information on the problem and how to fix it.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1

1 个答案:

答案 0 :(得分:0)

只需添加到gradle.properties中,然后重新构建即可。

android.useAndroidX=true
android.enableJetifier=true