deakjahn / isolate_handler

Effortless isolates abstraction layer with support for MethodChannel calls.
https://pub.dev/packages/isolate_handler
MIT License
51 stars 16 forks source link

Android And iOS Release Build: library 'package:flutter_isolate/flutter_isolate.dart' not found. #33

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 greatly 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.

Pubspec.yaml:

version: 1.0.0+1

environment: sdk: ">=2.17.0 <3.0.0"

dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.5

shared_preferences: ^2.0.15 fluttertoast: ^8.0.9 animations: ^2.0.3 dartdoc: ^6.0.1 email_validator: ^2.1.17 duration_picker: ^1.1.0+1 badges: ^2.0.3 mapbox_gl: ^0.16.0 sqflite: ^2.0.3 isolate_handler: ^1.0.1 photo_view: ^0.14.0 screenshot: ^1.2.3 wakelock: ^0.6.2 fuzzywuzzy: ^0.2.0 connectivity_plus: ^2.3.6+1 url_launcher: ^6.1.5 flutter_staggered_grid_view: ^0.6.2 location: ^4.4.0 flutter_plugin_android_lifecycle: ^2.0.7 flutter_isolate: ^2.0.2 file_saver: ^0.1.1 csv: ^5.0.1

dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^1.0.4

test: ^1.21.1 msix: ^3.6.2

Additionally, I have raised an identical issue over at: https://github.com/rmawatson/flutter_isolate/issues/117

deakjahn commented 2 years ago

Yes, I think we'll have to wait for that issue...

mterenzi commented 2 years ago

Okay, that's fine. I just wanted to cross post the issue here in case it was isolate_handlers specific implementation of flutter_isolate. But it looks like it's downstream on their code base. It seems like a @pragma('vm:entry-point") issue, but hard to say.

deakjahn commented 2 years ago

Yes, certainly, thank you for it, just that I seem to be unable to fix it from here. :-)

srmncnk commented 2 years ago

It's a pragma issue, but it also needed to be handled internally in the library, as your top level function is not the only one being called.

Also, there were some issues regarding sending data trough ports.

Consider a dependency override with this PR, it might fix your issues. 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 and dependency version updated.