Closed KaushikTejani closed 1 year ago
I got an issue in the release mode APK. I am implementing some code in the serviceMain function. It works fine in debug mode, but when I am building apk as release mode. The code was not working.
I found some issues in flutter flutter/flutter#91841
I was using the below dependency in the flutter project.
I tested the demo project of https://github.com/easazade/android-long-task/tree/master/example. It works perfect in release mode, but after using my project dependency, it stops working with the released mod
android_long_task: ^1.0.0 focused_menu: ^1.0.5 cupertino_icons: ^0.1.3 cached_network_image: ^2.0.0 flutter_switch: ^0.0.2 drawerbehavior: ^1.0.0 toast: ^0.1.5 pull_to_refresh: ^2.0.0 keyboard_visibility: ^0.5.6 get_it: ^7.2.0 syncfusion_flutter_charts: ^19.4.48 shared_preferences: url_launcher: youtube_player_flutter: firebase_messaging: ^10.0.9 firebase_auth: ^3.3.1 firebase_core: any flutter_local_notifications: ^9.3.2 #2.0.0 image_picker: any flutter_image_compress: uuid: flutter_native_timezone: ^1.0.5 awesome_notifications: ^0.6.21 sqflite: ^2.0.0+3 path: ^1.8.0 intl: ^0.17.0 localdb: ^0.0.3
I had a similar problem but after running "flutter upgrade", "flutter clean" and recompile the program, it started to work also in release mode.
I had a similar problem but after running "flutter upgrade", "flutter clean" and recompiling the program, it started to work also in release mode.
I was already done with that but still not working.
Same with me on Flutter 2.10 I have released a production app that is not working in release mode
The only fix was after downgraded to Flutter 2.5.3
Did you try to use the suggestion given in https://github.com/flutter/flutter/issues/91841?
I mean, to try to explicitly provide the package name in the call of the function DartEntryPoint in AppService.kt.
val entrypoint = DartEntrypoint("<name_of_the_package_given_in_AndroidManifest.xml>:lib/main.dart", "serviceMain")
For that to work, you have to download the android-long-task package, make that change and link it to your project in the “dependency_overrides:” section of the .yaml file.
Did you try to use the suggestion given in flutter/flutter#91841?
I mean, to try to explicitly provide the package name in the call of the function DartEntryPoint in AppService.kt.
val entrypoint = DartEntrypoint("<name_of_the_package_given_in_AndroidManifest.xml>:lib/main.dart", "serviceMain")
For that to work, you have to download the android-long-task package, make that change and link it to your project in the “dependency_overrides:” section of the .yaml file.
Thanks, I will check it out later this week and will return
@KaushikTejani Hi, I also had the same problem. I was using flutter 2.10.5
and android-long-task didn't work in release mode. I updated my flutter version into 2.13.0-0.4.pre
(beta version) and android-long-task works like a charm. Still waiting for it to be released into stable channel. I haven't checked with flutter latest stable 3.0.1
version because my application that depends on another packages simply breaks.
With Flutter 3.0.4 it works correct in release mode
Hi @AnkitBhojani2 did you solve this issue. if not can you try putting DartPluginRegistrant.ensureInitialized();
in the first line of your serviceMain
function
@pragma('vm:entry-point')
serviceMain() async {
DartPluginRegistrant.ensureInitialized();
...
}
I got an issue in the release mode APK. I am implementing some code in the serviceMain function. It works fine in debug mode, but when I am building apk as release mode. The code was not working.
I found some issues in flutter https://github.com/flutter/flutter/issues/91841