首页 > 解决方案 > CloudFirestorePlugin.java:235: 错误: 找不到符号, public void onFailure(@NonNull Exception e) { 符号: 类 NonNul

问题描述

我正在使用带有 firebase 的电话号码进行身份验证,但现在在 android 和 ios 中出现了一些错误。

我通过更改 和 的版本解决了 iosfirebase-auth错误fireabse_core。在此更改之前,flutter 项目在 Android 设备上运行良好,但更改后,我在 android 中遇到错误。

我浏览了一下,有人说,迁移到Androidx,但是我已经按照这个迁移了

安卓>android.properties:

android.enableJetifier=true
android.useAndroidX=true

这件事我已经改变了:

firebase_auth:
    git:
      url: https://github.com/collinjackson/plugins.git
      ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
      path: packages/firebase_auth  

pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  firebase_auth:
    git:
      url: https://github.com/collinjackson/plugins.git
      ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
      path: packages/firebase_auth  

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  flutter_launcher_icons: ^0.7.2+1
  page_transition:
  #firebase_auth: ^0.14.0+5

  firebase_core: ^0.4.0
  cloud_firestore: 
  fluttertoast:
  shared_preferences:
  swipedetector: ^1.2.0
  flutter_spinning_wheel: ^1.1.0
  tel_input:
  country_code_picker: ^1.1.7
  country_pickers: ^1.1.0
  intl:
  datetime_picker_formfield: ^0.1.1
  flutter_share_me: ^0.5.0
  image_picker:
  share:
  countdown: ^0.1.0
  splashscreen: ^1.2.0
  pin_code_text_field: ^1.3.7

android 设备的颤振运行输出:

/Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:8: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;                              
                                ^                                      
/Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:9: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;                             
                                ^                                      
/Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:235: error: cannot find symbol
         public void onFailure(@NonNull Exception e) {                 
                                ^                                      
 symbol: class NonNull                                                 
/Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:256: error: cannot find symbol
                   public Void apply(@NonNull Transaction transaction) 
                                      ^                                
 symbol: class NonNull                                                 
/Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:254: error: cannot find symbol
                   @Nullable                                           
                    ^                                                  
 symbol: class Nullable                                                
/Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:481: error: cannot find symbol
                   public void onFailure(@NonNull Exception e) {       
                                          ^                            
 symbol: class NonNull                                                 
/Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:534: error: cannot find symbol
                   public void onFailure(@NonNull Exception e) {       
                                          ^                            
 symbol: class NonNull                                                 
Note: /Users/sukhjinder/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.3.2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.                      
7 errors                                                                

FAILURE: Build failed with an exception.                                

* What went wrong:                                                      
Execution failed for task ':cloud_firestore: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.


Gradle task assembleDebug failed with exit code 1

标签: firebaseflutterpluginsdartfirebase-authentication

解决方案


推荐阅读