Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'package:home_widget/home_widget_callback_dispatcher.dart' not found #96

Closed
saad197 opened this issue Sep 2, 2022 · 6 comments · Fixed by #99
Closed

'package:home_widget/home_widget_callback_dispatcher.dart' not found #96

saad197 opened this issue Sep 2, 2022 · 6 comments · Fixed by #99

Comments

@saad197
Copy link

saad197 commented Sep 2, 2022

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:

[ +9 ms] E/flutter (14277): [ERROR:flutter/shell/common/shell.cc(88)] Dart Error: Dart_LookupLibrary: library
'package:home_widget/home_widget_callback_dispatcher.dart' not found.
[ ] E/flutter (14277): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
[ ] E/flutter (14277): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
[ ] E/flutter (14277): [ERROR:flutter/runtime/runtime_controller.cc(386)] Could not create root isolate.
[ ] E/flutter (14277): [ERROR:flutter/shell/common/shell.cc(605)] Could not launch engine with configuration.
[ +28 ms] W/FlutterJNI(14277): FlutterJNI.loadLibrary called more than once
[ ] W/FlutterJNI(14277): FlutterJNI.prefetchDefaultFontManager called more than once
[ ] W/FlutterJNI(14277): FlutterJNI.init called more than once
[ +8 ms] E/flutter (14277): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
[ ] E/flutter (14277): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
[ ] E/flutter (14277): [ERROR:flutter/runtime/runtime_controller.cc(386)] Could not create root isolate.
[ ] E/flutter (14277): [ERROR:flutter/shell/common/shell.cc(605)] Could not launch engine with configuration.

That makes no sense to me. What confuses me is that it is working fine in Debug. You can see here that the file is in my package beside the other one.

Doctor summary:

[✓] 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

@khjde1207
Copy link

I'm getting the error too.
Did you find a solution?

@khjde1207
Copy link

khjde1207 commented Sep 5, 2022

I found a solution.

This is a modification of the original source.

.pub-cache/hosted/pub.dartlang.org/home_widget-0.1.6/lib/home_widget_callback_dispatcher.dart

void callbackDispatcher() { ...

to

@pragma('vm:entry-point') // <- add
void callbackDispatcher() { ...

HomeWidget.registerBackgroundCallback(backgroundCallback);

@pragma('vm:entry-point') // <- add
void backgroundCallback(Uri? data) async {
  updateWidget(data);
}

@estebanyofre
Copy link

I have the same problem.
this solution worked for me

@Anderillo
Copy link

I also fixed it like this. This should be included in an upcoming update, in my opinion.

@linziyou0601
Copy link
Contributor

linziyou0601 commented Dec 10, 2022

I had made a pull request #99 approved by author of this project but it wasn't merged yet.

So you can change the dependencies from the version to my branch reference if you want to resolve this issue TEMPORARILY.

Following is an example:
Modify the reference to home_widget in this section

 # pubspec.yaml
 #...
 dependencies: 
   #...
-  home_widget: ^0.1.6
+  home_widget:
+    git:
+      url: https://github.com/linziyou0601/home_widget.git
+      ref: BackgroundDispatcherVmEntryError
   #...

@dasH128
Copy link

dasH128 commented Jan 17, 2023

I don't work for me BUT I added 2 lines of code in build.gradle(app) and it worked

buildTypes {
       release {
           shrinkResources false           <--- first line
           minifyEnabled false             <--- second line
           signingConfig signingConfigs.release
       }
   }

This is my version of flutter

Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 135454af32 (5 weeks ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants