【发布时间】:2019-08-31 09:17:49
【问题描述】:
我从颤振开始。 我编译了 Hello World 项目,它工作正常。 但是当我输入对 firebase_auth 的依赖时,我无法编译项目。
我按照以下步骤操作:
- 我在 pubspec.yaml 中插入了最新版本的 firebase_auth
dependencies:
firebase_auth: ^0.8.4+2
- 单击包获取。成功
- 运行“main.dart”。错误!
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
/usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.4+2/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
/usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.8.4+2/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java:10: error: cannot find symbol
import androidx.annotation.Nullable;
...
BUILD FAILED in 16s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
*******************************************************************************************
我见过的所有将 firebase_auth 与 Flutter 集成的教程都有效,但是在以前的版本中。
真的是安卓兼容性问题吗?
我搜索了几个小时关于错误但没有找到解决方案。
【问题讨论】:
-
尝试将项目android项目打开到Android Studio并修复Gradle问题。它可能会有所帮助
标签: firebase flutter firebase-authentication