Dart Error: Dart_LookupLibrary: library 'package:background_fetch/background_fetch.dart' not found
Asked Answered
M

1

13

How can I solve this problem:

E/flutter (18287): [ERROR:flutter/shell/common/shell.cc(89)] Dart Error: Dart_LookupLibrary: library 'package:background_fetch/background_fetch.dart' not found.
E/flutter (18287): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
E/flutter (18287): [ERROR:flutter/runtime/dart_isolate.cc(168)] Could not run the run main Dart entrypoint.
E/flutter (18287): [ERROR:flutter/runtime/runtime_controller.cc(389)] Could not create root isolate.
E/flutter (18287): [ERROR:flutter/shell/common/shell.cc(605)] Could not launch engine with configuration.

the problem just in the mode release, but in the mode debug the plugin is working normally.

More details:

[✓] Flutter (Channel master, 3.4.0-36.0.pre.8, on Ubuntu 22.04.1 LTS 5.15.0-48-generic, locale en_US.UTF-8) Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] Android Studio (version 2021.3)
[✓] Android Studio
[✓] VS Code
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Thank you.

Misha answered 8/10, 2022 at 10:44 Comment(0)
S
24

add @pragma('vm:entry-point') to background entry-point function

Shofar answered 13/10, 2022 at 1:0 Comment(3)
This solved it for me. I actually thought that the proguard file was enough to avoid the removing of "unused classes/methods" but apparently it wasnt.Summary
can you explain how ?Midge
@BilalAlmefleh It's not called by your Dart code, so the compiler thinks it's an unused function and can get rid of it. This pragma tells it not to. See github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/…Macnair

© 2022 - 2024 — McMap. All rights reserved.