flutter_downloader
flutter_downloader copied to clipboard
Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found
Callback function file is not found. Works fine in debug mode but gives error in release mode. Tried passing a static and top level function but gives error on all. only the file where the callback function is written gives this error.
$ flutter run --release Launching lib\main.dart on M2101K6G in release mode... w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath: C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.jar (version 1.5) C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.10/e1c380673654a089c4f0c9f83d0ddfdc1efdb498/kotlin-stdlib-jdk7-1.6.10.jar (version 1.6) C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.10/b8af3fe6f1ca88526914929add63cf5e7c5049af/kotlin-stdlib-1.6.10.jar (version 1.6) C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.10/c118700e3a33c8a0d9adc920e9dec0831171925/kotlin-stdlib-common-1.6.10.jar (version 1.6) w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath: C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.jar (version 1.5) C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.10/e1c380673654a089c4f0c9f83d0ddfdc1efdb498/kotlin-stdlib-jdk7-1.6.10.jar (version 1.6) C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.10/b8af3fe6f1ca88526914929add63cf5e7c5049af/kotlin-stdlib-1.6.10.jar (version 1.6) C:/Users/hp/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.10/c118700e3a33c8a0d9adc920e9dec0831171925/kotlin-stdlib-common-1.6.10.jar (version 1.6) w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath Running Gradle task 'assembleRelease'... 58.4s √ Built build\app\outputs\flutter-apk\app-release.apk (9.7MB). Installing build\app\outputs\flutter-apk\app.apk... 2,585ms
Flutter run key commands. h List all available interactive commands. c Clear the screen q Quit (terminate the application on the device). E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found. E/flutter (26553): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:mobile_chat_app/Utils/download_callback.dart' not found.
I am developing on mac. Flutter 3.0.5 with dart 2.17.6 is ok, but since flutter 3.3.0 with dart 2.18.0 and flutter 3.3.1 with dart 2.18.0 all cause the same problem: [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'download.dart' not found
.
so sho
It seems official flutter and dart reproduce the problem: flutter dart
so should we wait for the next update to roll out or is there any way to handle it?
so sho
It seems official flutter and dart reproduce the problem: flutter dart
so should we wait for the next update to roll out or is there any way to handle it?
My current temporary solution is to roll back flutter version to 3.0.5. You can use fvm to manage different flutter versions.
for now since i am not in a hurry, will wait for the next update to roll out. will keep you version in mind Thanks
After re-reading the document:
@pragma('vm:entry-point') must be placed above the callback function to avoid tree shaking in release mode for Android.
This will solve your problem of [Dart Error: Dart_LookupLibrary].
And it's irrelevant of the official flutter problem, sry for my previous wrong link issue.
It seems official flutter and dart reproduce the problem: flutter dart.
In my project, when using the @pragma in android release apk, it crashes with below error:
E/AndroidRuntime(27261): FATAL EXCEPTION: main
E/AndroidRuntime(27261): Process: com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0, PID: 27261
E/AndroidRuntime(27261): java.lang.RuntimeException: Unable to create service org.chromium.content.app.SandboxedProcessService0: java.lang.ClassNotFoundException: Didn't find class "org.chromium.content.app.SandboxedProcessService0" on path: DexPathList
dlopen failed: library "libandroidicu.so" not found: needed by /system/lib64/libharfbuzz_ng.so in namespace (default)
Maybe none of business of flutter_downloader plugin.
I finally found the problem. Because i fork the older version of flutter_downloader in tag 1.7.3. Because the the register callback use the DownloadTaskStatus class, i need to add @pragma('vm:entry-point') to DownloadTaskStatus class and the callback function, so that the android release mode won't tree-shake them. It will not influence iOS.
The relevant issue flutter/flutter#109248.
So there are 2 solutions:
- use flutter 3.0.5 or below;
- add annotation @pragma('vm:entry-point') to register callback, and add it to DownloadTaskStatus if you fork older version of flutter_downloader.
Do you mean that class explodes this mistake, add @pragma('vm:entry-point') to which class? @FaKenKoala
Same problem
same problem
I'm using geolocator plugin for capturing geolocation in background.(I spawned isolate that capture geolocation from plugin then save this data into sqlite database.) But in flutter 3.3.0 version it doesn't work. Error message is shown as below
E/flutter (24466): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:xxx/xxxxxx_service.dart' not found.
After I added '@pragma('vm:entry-point')' flag above the code that is callback function for handle data, it works.
Please add @pragma('vm:entry-point')
annotation to your download callback, as others have explained above.