rmawatson / flutter_isolate

Launch an isolate that can use flutter plugins.
MIT License
262 stars 80 forks source link

Flutter Release Android Build: library 'package:flutter_isolate/flutter_isolate.dart' not found. #117

Closed mterenzi closed 1 year ago

mterenzi commented 2 years ago

I just upgraded my flutter SDK from version 3.0.5 to 3.3.0 this morning and now I am unable to call isolates when building in release mode for Android. This behavior does not occur in debug builds. I have not tested on iOS.

Error:

Launching lib\main.dart on SM P610 in release mode... Building with Flutter multidex support enabled. √ Built build\app\outputs\flutter-apk\app-release.apk (20.7MB). E/flutter (12471): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library flutter_isolate/flutter_isolate.dart' not found. E/flutter (12471): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function. E/flutter (12471): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint. E/flutter (12471): [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate. E/flutter (12471): [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration. Application finished. Exited (sigterm)

Any advice on how to fix the binding would be appreciated.

Flutter Doctor:

[√] Flutter (Channel stable, 3.3.0, on Microsoft Windows [Version 10.0.19044.1889], locale en-US) • Flutter version 3.3.0 on channel stable at C:\Flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ffccd96b62 (3 days ago), 2022-08-29 17:28:57 -0700 • Engine revision 5e9e0e0aa8 • Dart version 2.18.0 • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at C:\Android_SDK • Platform android-31, build-tools 29.0.2 • Java binary at: C:\Program Files\Java\jdk-11.0.12\bin\java • Java version Java(TM) SE Runtime Environment 18.9 (build 11.0.12+8-LTS-237) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.7) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools • Visual Studio Build Tools 2019 version 16.11.31911.196 • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code, 64-bit edition (version 1.70.2) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.29.0

[√] Connected device (4 available) • SM P610 (mobile) • R52T508QFSP • android-arm64 • Android 12 (API 31) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1889] • Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.102 • Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.70

[√] HTTP Host Availability • All required HTTP hosts are available

! Doctor found issues in 1 category.

Thesmader commented 2 years ago

I also faced this same issue today. I am using isolate_handler which depends on this plugin. The isolate creation fails in release mode:

E/flutter ( 6127): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:flutter_isolate/flutter_isolate.dart' not found.
E/flutter ( 6127): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
E/flutter ( 6127): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
E/flutter ( 6127): [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate.
E/flutter ( 6127): [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration.
mterenzi commented 2 years ago

@Thesmader I am also using that package due to its ability to make platform dependent calls. Are you also experiencing this on iOS by any chance?

Coder-Manuel commented 2 years ago

I also faced this same issue today. I am using isolate_handler which depends on this plugin. The isolate creation fails in release mode:

E/flutter ( 6127): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:flutter_isolate/flutter_isolate.dart' not found.
E/flutter ( 6127): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
E/flutter ( 6127): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
E/flutter ( 6127): [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate.
E/flutter ( 6127): [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration.

I also got the same challenge with the builds from my pipeline which use the latest flutter version. A quick fix for me was to downgrade to flutter version 3.0.5.

srmncnk commented 2 years ago

This PR should fix it. https://github.com/rmawatson/flutter_isolate/pull/118

mterenzi commented 2 years ago

PR fixed the issue for me. Will close issue when officially merged.

mterenzi commented 1 year ago

Pull request has been merged. Waiting on pub version update and example documentation update to refrence the new pragma decorator requirement.

mterenzi commented 1 year ago

Pub version released. Closing issue,