【发布时间】:2020-10-11 09:33:28
【问题描述】:
我在我的颤振项目中插入了 firebase,最近它给了我一个输出错误。应用运行良好:
Plugin project :firebase_core_web not found. Please update settings.gradle.
运行flutter的医生说没发现问题。
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
}
我的 pubspec.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
...
搜索这个错误我发现了这些链接:
第一个和最后一个链接表示要解决此问题,需要在设置中添加以下代码。毕业:
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 错误?
【问题讨论】:
-
你在这个文件里有什么
.flutter-plugins? -
这个答案stackoverflow.com/a/61732682/7015400解释了为什么有人会收到这个错误,所以我认为最好的办法是创建一个新项目,确保有一个生成的
.flutter-plugins文件并使用最新版本的firestore和firebase 身份验证 -
嗨,你试过答案了吗?