rmawatson/flutter_isolate

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

brun0xon opened this issue · 12 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});

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

Yes, I wrote an example above

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.

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')

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

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

+1

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

@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

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.

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

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

Merged in #126