Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugin project :firebase_core_web not found. Please update settings.gradle

I've inserted firebase in my flutter project and recently it gives me an error on output. App works fine:

Plugin project :firebase_core_web not found. Please update settings.gradle.

Running flutter doctor says no problem was found.

buuild.gradle file:

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 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
...

Searching for this erros I found those links:

Firebase storage tutorial

Enable disable web support

Firebase core not found

The first and last links says to solve this the code below needs to be added in settings. 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
}

Even with this the error continues and adds many others:

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)

How to remove firebase_core_web not found error?

like image 965
learner Avatar asked Oct 15 '22 02:10

learner


1 Answers

@Peter Haddad Thank you for the explanation you gave in the post that helped me out with this issue. Simply adding

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
}

This code to settings.gradle resolved the issue

like image 63
Sasidhar Mankala Avatar answered Oct 19 '22 01:10

Sasidhar Mankala