Running the flutter app on the web I'm getting an exception only when the login is successful, when the the credentials are wrong the firebase_auth check works properly returning check validation that (Incorrect email address or password, please try again).
Error: MissingPluginException(No implementation found for method Query#observe on channel plugins.flutter.io/firebase_database)
at Object.throw_ [as throw] (http://localhost:18539/dart_sdk.js:5333:11)
at MethodChannel._invokeMethod (http://localhost:18539/packages/flutter/src/services/system_channels.dart.lib.js:954:21)
at _invokeMethod.next (<anonymous>)
at http://localhost:18539/dart_sdk.js:39031:33
at _RootZone.runUnary (http://localhost:18539/dart_sdk.js:38888:58)
at _FutureListener.thenAwait.handleValue (http://localhost:18539/dart_sdk.js:33874:29)
at handleValueCallback (http://localhost:18539/dart_sdk.js:34434:49)
at Function._propagateToListeners (http://localhost:18539/dart_sdk.js:34472:17)
at _Future.new.[_completeWithValue] (http://localhost:18539/dart_sdk.js:34314:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:18539/dart_sdk.js:34337:35)
at Object._microtaskLoop (http://localhost:18539/dart_sdk.js:39175:13)
at _startMicrotaskLoop (http://localhost:18539/dart_sdk.js:39181:13)
at http://localhost:18539/dart_sdk.js:34688:9
So far I've tried the solutions here https://github.com/flutter/flutter/issues/13971 , I/flutter (22027): MissingPluginException(No implementation found for method DocumentReference#setData on channel plugins.flutter.io/cloud_firestore) running
flutter clean
flutter packages get
Also deleting the file
pubspec.lock
And running flutter packages get
This issue occurs only when flutter app is running on the web, on android and iOS devices it runs correctly
Also try to add the firebase_auth_web and firebase_storage_web
Flutter 2.0.4 • channel stable
Framework • revision b1395592de (3 weeks ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2
# Firebase dependencies
firebase_core: ^0.5.3
firebase_database: ^4.4.0
firebase_auth: ^0.18.4+1
firebase_storage: ^4.0.0
firebase_storage_web:
firebase_messaging: ^7.0.3
Related
final NotificationSettings settings = await messaging.requestPermission();
I am getting this error when calling requestPermission() method of firebase messaging.
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method Messaging#requestPermission on channel plugins.flutter.io/firebase_messaging)
E/flutter ( 7180): #0 convertPlatformException (package:firebase_messaging_platform_interface/src/method_channel/utils/exception.dart:13:5)
E/flutter ( 7180): #1 MethodChannelFirebaseMessaging.requestPermission (package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:286:13)
E/flutter ( 7180):
In build.gradle i implemented
'com.google.firebase:firebase-messaging'
implementation platform('com.google.firebase:firebase-bom:28.3.0')
I had the same issue. Fixed it updating to the last version:
firebase_core: ^1.10.0
firebase_messaging: ^11.1.0
Use the latest versions of below packages
firebase_core
https://pub.dev/packages/firebase_core/versions
firebase_messaging
https://pub.dev/packages/firebase_messaging/versions
Terminate the current running session.
Do flutter pub get in your terminal
Then run again.
remove onBackgroundmessage from the firebase configure, it's a temporary solution but it works for older firebase packages
I want build app flutter on web but I get error when I run
flutter run -d chrome
error
Error: Unsupported operation: Platform._operatingSystem
at Object.throw_ [as throw] (http://localhost:55259/dart_sdk.js:5334:11)
at Function._operatingSystem (http://localhost:55259/dart_sdk.js:56144:17)
at Function.get operatingSystem [as operatingSystem] (http://localhost:55259/dart_sdk.js:56190:27)
at get _operatingSystem (http://localhost:55259/dart_sdk.js:56103:27)
at Function.desc.get [as _operatingSystem] (http://localhost:55259/dart_sdk.js:5839:17)
at Function.get operatingSystem [as operatingSystem] (http://localhost:55259/dart_sdk.js:56056:26)
at main$ (http://localhost:55259/packages/doxaspc/main.dart.lib.js:205:48)
at main$.next (<anonymous>)
at http://localhost:55259/dart_sdk.js:39032:33
at _RootZone.runUnary (http://localhost:55259/dart_sdk.js:38889:58)
at _FutureListener.thenAwait.handleValue (http://localhost:55259/dart_sdk.js:33875:29)
at handleValueCallback (http://localhost:55259/dart_sdk.js:34435:49)
at Function._propagateToListeners (http://localhost:55259/dart_sdk.js:34473:17)
at _Future.new.[_completeWithValue] (http://localhost:55259/dart_sdk.js:34315:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:55259/dart_sdk.js:34338:35)
at Object._microtaskLoop (http://localhost:55259/dart_sdk.js:39176:13)
at _startMicrotaskLoop (http://localhost:55259/dart_sdk.js:39182:13)
at http://localhost:55259/dart_sdk.js:34689:9
function main of me
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
I have build a app android and it work good. but when I want anable web see error above
please show me how fix it?
I had the same error with a mobile flutter app to configure in Web.
It was because some packages are available only for Android and IOS, and not for the Web.
Maybe you should replace your packages with an equivalent available for all platforms.
FlutterFire plugins for web may still be errorneous
Please follow the guide as suggested here
I've been trying to use the auth, firestore firebase in an Android / IOS flutter application, and have been experiencing many different issues, after testing several different versions. Now it's showing me several messages in the build log.
build log
Note:
D:\Flutter\SDK\flutter.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.3+1\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java
uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details. Note: D:\Flutter\SDK\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.0+1\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java
uses unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details. D8: Cannot fit requested classes in a single dex file (# methods: 81454 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while
merging dex archives: The number of method references in a .dex file
cannot exceed 64K. Learn how to resolve this issue at
https://developer.android.com/tools/building/multidex.html
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748) Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to
complete
at com.android.tools.r8.utils.t.a(:55)
at com.android.tools.r8.D8.run(:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
... 34 more Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit
requested classes in a single dex file (# methods: 81454 > 65536)
at com.android.tools.r8.utils.Reporter.a(:21)
at com.android.tools.r8.utils.Reporter.a(:7)
at com.android.tools.r8.dex.VirtualFile.a(:33)
at com.android.tools.r8.dex.VirtualFile$h.a(:5)
at com.android.tools.r8.dex.ApplicationWriter.a(:13)
at com.android.tools.r8.dex.ApplicationWriter.write(:35)
at com.android.tools.r8.D8.d(:44)
at com.android.tools.r8.D8.b(:1)
at com.android.tools.r8.utils.t.a(:23)
... 36 more
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:mergeDexDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
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 4m 33s
flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows
[Version 10.0.18362.535], locale en-IN)
• Flutter version 1.12.13+hotfix.5 at D:\Flutter\SDK\flutter
• Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK
version 29.0.2)
• Android SDK at C:\Users\admin\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Android SDK\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at D:\Android SDK
• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
pubspec
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.15.3
cloud_firestore: ^0.13.0+1
build.gradle(android)
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.0'
}
You need to use the following plugin:
dependencies:
firebase_auth: ^0.15.3
cloud_firestore: ^0.13.0+1
Don't forget to configure firebase:
https://pub.dev/packages/cloud_firestore#setup
https://pub.dev/packages/firebase_auth#usage
Also in your app/build.gradle, increase the minSdkVersion:
Change this:
minSdkVersion 16
into this:
minSdkVersion 23
In order to use minSdkVersion below 21 you will have to configure your app for multidex like this:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}
After this please run the
flutter pub upgrade
flutter pub get
flutter clean
flutter run
It will still throw the warning after flutter clean, but at least it will be possible for supporting earlier versions.
More to check out on official docs
Here is where the exception is happening:
#override
Future<FirebaseUser> getCurrentUser() async {
FirebaseUser user = await _firebaseAuth.currentUser();
return user;
}
The exact error is:
Exception has occurred.
PlatformException (PlatformException(error, FirebaseApp with name [DEFAULT] doesn't exist. , null))
My Flutter Doctor Output:
[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
• Flutter version 1.12.13+hotfix.5 at D:\src\flutter
• Framework revision 27321ebbad (7 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\jcdos\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.5)
• Android Studio at D:\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
exit code 0
Here is my debug console:
E/flutter ( 6562): #40 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5445
E/flutter ( 6562): #41 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3194
E/flutter ( 6562): #42 Element.updateChild
package:flutter/…/widgets/framework.dart:2988
E/flutter ( 6562): #43 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter ( 6562): #44 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter ( 6562): #
√ Built build\app\outputs\apk\debug\app-debug.apk.
I've tried finding other sources to fix the error, but nothing works. I removed apply plugin: 'com.google.gms.google-services' from the app gradle as that was causing me other issues. And removing this fixed it, as the source I found said it gets called already somewhere else.
And if I keep the com.google.gms.google-services then I get this error which prevents the app from running in the emulator all together:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'com.example.testapp
Add below line into your android/app/build.gradle file:
apply plugin: 'com.google.gms.google-services'
Run the application in Android studio it should show some of the errors or files that need to be updated like in the build.gradle files. Also, you need the com.google.gms.google-services for firebase.
I am trying to add Firebase to my flutter app. But when I add firebase_core dependency in the pubspec_yaml and run Packages get, it gives an error.
19-----dependencies:
20-----flutter:
21-----sdk: flutter
22-----firebase_core: ^0.2.5
This is the code that gives the error.
The output of Packages get :
C:\flutter\bin\flutter.bat --no-color packages get
Running "flutter packages get" in trial_one...
Error on line 21, column 5 of pubspec.yaml: A dependency may only have one source.
sdk: flutter
^^^^^^^^^^^^^^
pub get failed (65)
Process finished with exit code 65
I followed the exact instructions on the Add Firebase to Flutter site. But still I get this error.
The indentation is actually not good, here's the correct one :
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.3.1+1
Hope it's help !!