Я вставил firebase в свой проект flutter, и недавно он выдает ошибку при выводе. Приложение работает нормально:
Plugin project :firebase_core_web not found. Please update settings.gradle.
Работающий доктор говорит, что проблем не обнаружено.
файл buuild.gradle:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.sample.flutter_with_firebase"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
My pubspe c .yaml:
...
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
firebase_core: ^0.4.5
firebase_auth: ^0.14.0+5
cloud_firestore: ^0.12.9+4
provider: ^3.1.0
...
В поисках этих ошибок я нашел следующие ссылки:
Учебник по хранилищу Firebase
Включить, отключить веб-поддержку
Ядро Firebase не найдено
Первая и последняя ссылки говорят, что для решения этой проблемы в настройках необходимо добавить приведенный ниже код. gradle:
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if(pluginsFile.exists()){
pluginsFile.withReader('UTF-8'){ reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDir = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ':$name'
project(':$name').projectDir = pluginDir
}
Даже при этом ошибка продолжается и добавляет много других:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Plugin project :firebase_core_web not found. Please update settings.gradle.
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:9: error: package io.flutter.embedding.engine.plugins does not exist
import io.flutter.embedding.engine.plugins.FlutterPlugin;
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:10: error: package io.flutter.plugin.common does not exist
import io.flutter.plugin.common.MethodCall;
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:11: error: package io.flutter.plugin.common does not exist
import io.flutter.plugin.common.MethodChannel;
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:12: error: package io.flutter.plugin.common does not exist
import io.flutter.plugin.common.PluginRegistry;
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:23: error: cannot find symbol
public class FirebaseCorePlugin implements FlutterPlugin, MethodChannel.MethodCallHandler {
^
symbol: class FlutterPlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:23: error: package MethodChannel does not exist
public class FirebaseCorePlugin implements FlutterPlugin, MethodChannel.MethodCallHandler {
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:26: error: cannot find symbol
private MethodChannel channel;
^
symbol: class MethodChannel
location: class FirebaseCorePlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:35: error: package PluginRegistry does not exist
public static void registerWith(PluginRegistry.Registrar registrar) {
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:53: error: cannot find symbol
public void onAttachedToEngine(FlutterPluginBinding binding) {
^
symbol: class FlutterPluginBinding
location: class FirebaseCorePlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:60: error: cannot find symbol
public void onDetachedFromEngine(FlutterPluginBinding binding) {
^
symbol: class FlutterPluginBinding
location: class FirebaseCorePlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:81: error: cannot find symbol
public void onMethodCall(MethodCall call, final MethodChannel.Result result) {
^
symbol: class MethodCall
location: class FirebaseCorePlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:81: error: package MethodChannel does not exist
public void onMethodCall(MethodCall call, final MethodChannel.Result result) {
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:36: error: cannot find symbol
final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME);
^
symbol: class MethodChannel
location: class FirebaseCorePlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:36: error: cannot find symbol
final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME);
^
symbol: class MethodChannel
location: class FirebaseCorePlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:52: error: method does not override or implement a method from a supertype
@Override
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:55: error: cannot find symbol
channel = new MethodChannel(binding.getBinaryMessenger(), CHANNEL_NAME);
^
symbol: class MethodChannel
location: class FirebaseCorePlugin
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:59: error: method does not override or implement a method from a supertype
@Override
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:80: error: method does not override or implement a method from a supertype
@Override
^
C:\Development\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java:82: error: illegal start of type
switch (call.method) {
^
19 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':$name: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 16s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Как удалить ошибку firebase_core_web not found?