gpt4 book ai didi

android - 插件项目 :firebase_core_web not found. 请更新 settings.gradle

转载 作者:行者123 更新时间:2023-12-03 19:10:03 26 4
gpt4 key购买 nike

我在我的 flutter 项目中插入了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
...
搜索这个错误我发现了这些链接:
Firebase storage tutorial
Enable disable web support
Firebase core not found
第一个和最后一个链接说要解决这个问题,需要在设置中添加以下代码。毕业典礼:
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 错误?

最佳答案

@ Peter Haddad感谢您在帖子中给出的解释,帮助我解决了这个问题。只需添加

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 pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
此代码为 settings.gradle解决了这个问题

关于android - 插件项目 :firebase_core_web not found. 请更新 settings.gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62498902/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com