Flutter_cached_network_image: Unhandled Exception: MissingPluginException when app is in background

Created on 24 Nov 2019  路  23Comments  路  Source: Baseflow/flutter_cached_network_image

Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)

needs more info

Most helpful comment

I found the solution!
After adding the plugin I had to rebuild the Android code.
The hot reload did not work correctly.

All 23 comments

+

Quite application and start again.
a database must be created for caching.

I don't understand what is happening here. The MissingPluginException should not occur although there is no database yet. What platform is this? (Android or iOS) Can you reproduce this easily?

1銆乫lutter use flutter_cached_network_image
2銆乫lutter add-to-app
3銆乥uild aar then build app

https://github.com/tekartik/sqflite/issues/368

Ah looks like an issue with the sqflite plugin when embedding. If I have time I can have a look at that plugin, but I don't make a promise.

MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)
[log]

0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)

1 invokeMethod (package:sqflite/src/sqflite_impl.dart:20:13)

This should be fixed in sqflite (1.2.2 just published ok)

This should be fixed in sqflite (1.2.2 just published ok)

unsolved for embedding

@mcxinyu How can I reproduce the issue? Do you have simple project showing the issue ? I'm not sure what you mean by unsolved for embedding. Are you following the guide here: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

I can provide sample projects later

Maybe it's a problem with my code. I didn't reproduce it when I wrote the sample. Thanks

same here (version ^2.3.0-beta):
2020-05-25 11:47:46.057 4563-4893/ch.XXX.dev E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite) #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7) <asynchronous suspension> #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12) #2 invokeMethod (package:sqflite/src/sqflite_impl.dart:17:13) #3 SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:31:7) #4 SqfliteDatabaseFactoryMixin.safeInvokeMethod.<anonymous closure> (package:sqflite_common/src/factory_mixin.dart:25:35) #5 wrapDatabaseException (package:sqflite/src/exception_impl.dart:7:32) #6 SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:27:7) #7 SqfliteDatabaseFactoryMixin.safeInvokeMethod (package:sqflite_common/src/factory_mixin.dart:25:7) #8 SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite_common/src/factory_mixin.dart:143:26) #9 getDatabasesPath (package:sqflite/sqflite.dart:168:54) #10 CacheStore._getObjectProvider (package:flutter_cache_manager/src/cache_store.dart:43:33) #11 new CacheStore (package:flutter_cache_manager/src/cache_store.dart:39:49) #12 new BaseCacheManager (package:flutter_cache_manager/src/cache_manager.dart:83:9) #13 new DefaultCacheManager._ (package:flutter_cache_manager/src/cache_manager.dart:38:29) #14 new DefaultCacheManager (package:flutter_cache_manager/src/cache_manager.dart:34:39) #15 CachedNetworkImageState._cacheManager (package:cached_network_image/src/cached_image_widget.dart:404:35) #16 CachedNetworkImageState._createFileStream (package:cached_network_image/src/cached_image_widget.dart:242:19) #17 CachedNetworkImageState.initState (package:cached_network_image/src/cached_image_widget.dart:219:5) #18 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4644:58) #19 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4480:5) #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3450:14) #21 Element.updateChild (package:flutter/src/widgets/framework.dart:3218:18) #22 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4531:16) #23 Element.rebuild (package:flutter/src/widgets/framework.dart:4222:5) #24 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4485:5) #25 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4480:5) #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3450:14) #27 Element.updateChild (package:flutter/src/widgets/framework.dart:3218:18) #28 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4531:16) #29 Element.rebuild (package:flutter/src/widgets/framework.dart:4222:5) #30 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4485:5) #31 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4480:5) #32 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3450:14) #33 Element.updateChild (package:flutter/src/widgets/framework.dart:3218:18) #34 _ListTileElement._mountChild (package:flutter/src/material/list_tile.dart:1039:30) #35 _ListTileElement.mount (package:flutter/src/material/list_tile.dart:1053:5) #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3450:14) #37 Element.updateChild (package:flutter/src/widgets/framework.dart:3218:18) #38 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4531:16) #39 Element.rebuild (package:flutter/src/widgets/framework.dart:4222:5) #40 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4485:5) #41 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4480:5) #42 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3450:14) #43 Element.update

@sjoe do you have a reproducable example? I cannot fix much with just this stacktrace.

I found the solution!
After adding the plugin I had to rebuild the Android code.
The hot reload did not work correctly.

I guess the MissingPluginException is in general a case of a proper rebuild of the app, so I'll close this issue.

Its happening while app is in background (not terminated), access to the database error has thrown.
Screenshot 2020-06-01 at 5 01 45 PM

@SureShDood that is useful information. Is this on Android or iOS?

If you need to use sqflite in a FCM messaging context, i think you need to register the plugin at the application level.

See a related issue here: https://github.com/tekartik/sqflite/issues/446

if the project was generated a long time ago, you might have to follow https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration

@renefloor Its occurred an android. @alextekartik Thanks. It's solved.

Thanks for the quick response @alextekartik

@renefloor Its occurred an android. @alextekartik Thanks. It's solved.

How did you solve it?
Trying to use it in background isolate (pub workmanager)
Flutter 1.20.4

We have a similar issue, but for some reason it happens only for the production build. This is happening since we have migrated to Android Embedded V2 https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

Was this page helpful?
0 / 5 - 0 ratings