Reputation: 47
A very strange issue. I am using https://pub.dev/packages/home_widget and I am trying to use the backgroundCallback to refresh my widget by pressing an image on the widget. It works fine on debug mode, however when I build apk or run flutter run --release --verbose I get the error below (well in apk I can't see the error but it does not work either).
I get this error after tapping the image with the callback URI:
[+7444 ms] E/flutter ( 9412): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library
'package:home_widget/home_widget_callback_dispatcher.dart' not found.
[ +2 ms] E/flutter ( 9412): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
[ ] E/flutter ( 9412): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
[ ] E/flutter ( 9412): [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate.
[ ] E/flutter ( 9412): [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration.
That makes no sense to me. You can see here that the file is in my package beside the other one. Does anyone know why this might happen?
What confuses me is that it is working fine in Debug.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.4.0-19.0.pre.35, on Microsoft Windows [Version 10.0.22000.856], locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Chrome - develop for the web
[✗] Visual Studio - develop for Windows
✗ Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[✓] Android Studio (version 2021.2)
[✓] VS Code, 64-bit edition (version 1.67.2)
[✓] Connected device (4 available)
[✓] HTTP Host Availability
Upvotes: 3
Views: 1517
Reputation: 21
add this code --> @pragma('vm:entry-point')
STEP 1 : Project -> External Libraies -> Dart Packages -> home_widget-0.1.6 -> home_widget_callback_dispatcher.dart
STEP 2 :
see also Dart Error: Dart_LookupLibrary: library 'package:background_fetch/background_fetch.dart' not found
Home Widget -> flutter run --release it is work I leave the application link below, you can test it https://play.google.com/store/apps/details?id=com.ramzey.bankadovizpro
Source Code : https://www.roketnot.com/not/1608-home-screen-widget-kullanimi-telefonun-ana-ekranina-widget-koyma
same problem here Flutter Dart Error: Dart_LookupLibrary: library 'package:home_widget/home_widget_callback_dispatcher.dart' not found
Upvotes: 0
Reputation: 41
I just had a similar problem with AndroidAlarmManager. Seems like since the last flutter update, running the app with the --release flag won't let service extensions run (see the docs here). This is new, it used to work in the release mode. You can use the --profile mode, which strips down some of the debugging functionality, so the app runs smoothly (unlike in the debug mode), but still lets service extensions run.
Again, it is well explained in the docs, if you want to go into detail.
flutter run --profile
Hope this fixes your problem.
Regards, Honza
Upvotes: 0