Launching lib/main.dart on Redmi Note 4 in debug mode...
error: error reading /home/gagan/.gradle/caches/modules-2/files-2.1/com.google.auto.value/auto-value-annotations/1.6.3/b88c1bb7f149f6d2cc03898359283e57b08f39cc/auto-value-annotations-1.6.3.jar; zip file is empty
error: error reading /home/gagan/.gradle/caches/modules-2/files-2.1/com.google.auto.value/auto-value-annotations/1.6.3/b88c1bb7f149f6d2cc03898359283e57b08f39cc/auto-value-annotations-1.6.3.jar; zip file is empty
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:8: error: package com.google.firebase.components does not exist
import com.google.firebase.components.Component;
^
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:9: error: package com.google.firebase.components does not exist
import com.google.firebase.components.ComponentRegistrar;
^
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:10: error: package com.google.firebase.platforminfo does not exist
import com.google.firebase.platforminfo.LibraryVersionComponent;
^
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:15: error: cannot find symbol
public class FlutterFirebaseAppRegistrar implements ComponentRegistrar {
^
symbol: class ComponentRegistrar
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:17: error: cannot find symbol
public List<Component<?>> getComponents() {
^
symbol: class Component
location: class FlutterFirebaseAppRegistrar
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/MethodCallHandlerImpl.java:15: error: package com.google.firebase does not exist
import com.google.firebase.FirebaseApp;
^
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:16: error: method does not override or implement a method from a supertype
@Override
^
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:19: error: cannot find symbol
LibraryVersionComponent.create(BuildConfig.LIBRARY_NAME, BuildConfig.LIBRARY_VERSION));
^
symbol: variable LibraryVersionComponent
location: class FlutterFirebaseAppRegistrar
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/FlutterFirebaseAppRegistrar.java:18: error: cannot find symbol
return Collections.<Component<?>>singletonList(
^
symbol: class Component
location: class FlutterFirebaseAppRegistrar
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/MethodCallHandlerImpl.java:230: error: cannot find symbol
database = FirebaseDatabase.getInstance(FirebaseApp.getInstance(appName), databaseURL);
^
symbol: variable FirebaseApp
location: class MethodCallHandlerImpl
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/MethodCallHandlerImpl.java:232: error: cannot find symbol
database = FirebaseDatabase.getInstance(FirebaseApp.getInstance(appName));
^
symbol: variable FirebaseApp
location: class MethodCallHandlerImpl
/home/gagan/applications/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.6/android/src/main/java/io/flutter/plugins/firebase/database/MethodCallHandlerImpl.java:232: error: cannot access FirebaseApp
database = FirebaseDatabase.getInstance(FirebaseApp.getInstance(appName));
^
class file for com.google.firebase.FirebaseApp not found
12 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_database: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 11s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
我已经在使用AndroidX,并且已经在Firebase中注册了我的应用程序。 Firebase Auth(尝试过Google登录和电子邮件登录/注册)可以工作,但是当我在firebase_database: ^3.1.6
中添加pubspec.yaml
时,我遇到了这类错误。
我还尝试将firebase_database
的版本降级为3.1.0
,但没有用
app/build.gradle
中的依赖项:
dependencies {
// implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
compileSdkVersion和targetSdkVersion设置为28
使用的Firebase插件
firebase_auth: ^0.16.1
firebase_database: ^3.1.6
firebase_core: ^0.4.5
编辑:- flutter clean
和flutter pub get
也不起作用。