flutter_isolate icon indicating copy to clipboard operation
flutter_isolate copied to clipboard

library 'package:flutter_isolate/src/compute.dart' not found

Open brun0xon opened this issue 2 years ago • 8 comments

flutter_isolate: ^2.0.3 Flutter 3.3.3 Android 12

Hello. Tried to use flutterCompute() function. In debug it perfectly works, but when dealing with release, then getting this error: [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:flutter_isolate/src/compute.dart' not found.

A function, that passed to flutterCompute(), is top-level and annotated with @pragma('vm:entry-point')

@pragma('vm:entry-point')
Future<bool> cacheData(Map<String, dynamic> params) async {...}

...
flutterCompute(cacheData, {'environment': 1});

brun0xon avatar Oct 05 '22 11:10 brun0xon

Did you decorate your function with @pragma('vm:entry-point')

?

On 5 Oct 2022, at 7:51 PM, brun0xon @.***> wrote:

 flutter_isolate: ^2.0.3 Flutter 3.3.3 Android 12

Hello. Tried to use flutterCompute() function. In debug it perfectly works, but when dealing with release, then getting this error: [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:flutter_isolate/src/compute.dart' not found.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

nmfisher avatar Oct 05 '22 14:10 nmfisher

Did you decorate your function with @pragma('vm:entry-point')

Yes, I wrote an example above

brun0xon avatar Oct 05 '22 15:10 brun0xon

Can you reproduce this in a standalone sample project?

Also it might be worth trying the following release configuration in build.gradle:

release {
        shrinkResources false // ADD THIS
        minifyEnabled false // ADD THIS
}

I've recently (> Flutter 3.x) started having trouble with plugins on Android not working in in release mode. Seems the plugin registration method lookup isn't working due to some kind of symbol minification.

nmfisher avatar Oct 07 '22 00:10 nmfisher

Also having similar issues with flutterCompute in flutter 3.3.4 and iOS. The call just hangs and never completes. Worked fine with flutter 3.0.5 and earlier version of this package. Works fine in debug/profile, but stops working correctly in release. function is annotated with @pragma('vm:entry-point')

jaysignorello avatar Oct 07 '22 23:10 jaysignorello

Can you reproduce this in a standalone sample project?

Also it might be worth trying the following release configuration in build.gradle:

release {
        shrinkResources false // ADD THIS
        minifyEnabled false // ADD THIS
}

I've recently (> Flutter 3.x) started having trouble with plugins on Android not working in in release mode. Seems the plugin registration method lookup isn't working due to some kind of symbol minification.

i also facing the same issue , and i do added 'shrinkResources' and 'minifyEnabled' but isnt solve

abdalmonem avatar Oct 11 '22 14:10 abdalmonem

i do added 'shrinkResources' and 'minifyEnabled' but isnt solve

+1

brun0xon avatar Oct 11 '22 14:10 brun0xon

Solved by adding @pragma('vm:entry-point') to functions flutterCompute() and _isolateMain() in compute.dart file. Please, publish fix as soon as possible.

brun0xon avatar Oct 12 '22 05:10 brun0xon

@brun0xon if you mean addding @pragma('vm:entry-point') to the top level function i would say its also doesnt work edit: i get it , and correct edit the source flutterCompute and _isolateMain methods with a @pragma('vm:entry-point') at the top of them solve the issue

abdalmonem avatar Oct 12 '22 06:10 abdalmonem

The project below results in the error when building on Flutter 3.3.6 and running in release mode. flutter_isolate_issue.zip

Solved by adding @pragma('vm:entry-point') to functions flutterCompute() and _isolateMain() in compute.dart file. Please, publish fix as soon as possible.

This seems to solve the issue in the example above. When I copy the code from the master branch into the project and add the @pragma on those methods everything seems to work fine.

jopmiddelkamp avatar Nov 03 '22 20:11 jopmiddelkamp

How is it possible this hasn't been solved for more than a month even though people here showed how to fix it?

ziggycrane avatar Nov 08 '22 16:11 ziggycrane

@ziggycrane are you offering to pay me to fix this?

nmfisher avatar Nov 08 '22 22:11 nmfisher

Merged in #126

nmfisher avatar Nov 12 '22 06:11 nmfisher