由于云 firestore 和 firebase 身份验证错误,我的 Flutter 应用程序不再编译
My Flutter app doesnt compile anymore due to cloud firestore and firebase auth errors
我花了几天时间尝试使用 Firebase 调试我的应用程序。
以前一切正常,直到上周我更新了很多东西; android studio、flutter、插件等。
编译后这始终是我的结果;
import android.support.annotation.NonNull;
^
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:538: error: cannot find symbol
public void onComplete(@NonNull Task<AuthResult> task) {
^
symbol: class NonNull
location: class FirebaseAuthPlugin.SignInCompleteListener
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:558: error: cannot find symbol
public void onComplete(@NonNull Task<Void> task) {
^
symbol: class NonNull
location: class FirebaseAuthPlugin.TaskVoidCompleteListener
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:576: error: cannot find symbol
public void onComplete(@NonNull Task<ProviderQueryResult> task) {
^
symbol: class NonNull
location: class FirebaseAuthPlugin.ProvidersCompleteListener
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:175: error: cannot find symbol
public void onComplete(@NonNull Task<AuthResult> task) {
^
symbol: class NonNull
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:270: error: cannot find symbol
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
^
symbol: class NonNull
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:435: error: cannot find symbol
public void onComplete(@NonNull Task<GetTokenResult> task) {
^
symbol: class NonNull
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:487: error: cannot find symbol
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
^
symbol: class NonNull
Note: /home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
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 2m 48s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Exception: The plugin cloud_firestore could not be built due to the issue above.
我尝试了有关 androidX 的不同修复,但我的项目已经迁移并且一直如此 none 似乎可以正常工作。
Flutter doctor 输出很好
[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Android Studio
[✓] Connected device (1 available)
• No issues found!```
已找到解决方案!!
这确实是由 AndroidX 个问题引起的,但迁移无济于事。
所以我用来解决它的步骤是;
打开 android 文件夹以使用 Android Studio 进行编辑。
2.Run Gradle 同步。
3.Run 应用程序。
(这显然会失败!但带您到使用 Android 支持库导入的文件。)
删除 android 支持导入(import android.support.annotations.NonNull
)并替换为 AndroidX 导入。
进口androidx.annotations.NonNull
(我不记得确切的导入语句,但你可以 google 并获取它)
就是这样,祝一切顺利!!
我花了几天时间尝试使用 Firebase 调试我的应用程序。 以前一切正常,直到上周我更新了很多东西; android studio、flutter、插件等。 编译后这始终是我的结果;
import android.support.annotation.NonNull;
^
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:538: error: cannot find symbol
public void onComplete(@NonNull Task<AuthResult> task) {
^
symbol: class NonNull
location: class FirebaseAuthPlugin.SignInCompleteListener
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:558: error: cannot find symbol
public void onComplete(@NonNull Task<Void> task) {
^
symbol: class NonNull
location: class FirebaseAuthPlugin.TaskVoidCompleteListener
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:576: error: cannot find symbol
public void onComplete(@NonNull Task<ProviderQueryResult> task) {
^
symbol: class NonNull
location: class FirebaseAuthPlugin.ProvidersCompleteListener
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:175: error: cannot find symbol
public void onComplete(@NonNull Task<AuthResult> task) {
^
symbol: class NonNull
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:270: error: cannot find symbol
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
^
symbol: class NonNull
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:435: error: cannot find symbol
public void onComplete(@NonNull Task<GetTokenResult> task) {
^
symbol: class NonNull
/home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:487: error: cannot find symbol
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
^
symbol: class NonNull
Note: /home/baw/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.6.2+1/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
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 2m 48s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Exception: The plugin cloud_firestore could not be built due to the issue above.
我尝试了有关 androidX 的不同修复,但我的项目已经迁移并且一直如此 none 似乎可以正常工作。
Flutter doctor 输出很好
[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Android Studio
[✓] Connected device (1 available)
• No issues found!```
已找到解决方案!!
这确实是由 AndroidX 个问题引起的,但迁移无济于事。 所以我用来解决它的步骤是;
打开 android 文件夹以使用 Android Studio 进行编辑。 2.Run Gradle 同步。 3.Run 应用程序。 (这显然会失败!但带您到使用 Android 支持库导入的文件。)
删除 android 支持导入(
import android.support.annotations.NonNull
)并替换为 AndroidX 导入。进口androidx.annotations.NonNull
(我不记得确切的导入语句,但你可以 google 并获取它)
就是这样,祝一切顺利!!