fluttercommunity / flutter_downloader

Flutter Downloader - A plugin for creating and managing download tasks.
https://pub.dev/packages/flutter_downloader
BSD 3-Clause "New" or "Revised" License
920 stars 517 forks source link

App crash when I start a download #483

Open brwno opened 3 years ago

brwno commented 3 years ago

Hello. I'm using flutter_download to make a download of a PDF who your origin is a simple URL, but after update to flutter 2.2.2, my app crashing after start a download. Is the same in iOS or Android.

Flutter doctor -v

[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-BR)
    • Flutter version 2.2.2 at /Users/desenvolvimentoapp/dev/flutter
    • Framework revision d79295af24 (12 days ago), 2021-06-11 08:56:01 -0700
    • Engine revision 91c9fc8fe0
    • Dart version 2.13.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/desenvolvimentoapp/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 51.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

My code:

> IconButton(
>                   icon: Icon(Icons.share),
>                   onPressed: () async {
>                     Directory tempDir = await getExternalStorageDirectory();
>                     await FlutterDownloader.enqueue(
>                       url: urlDownload,
>                       savedDir: tempDir.path,
>                       showNotification: false,
>                       openFileFromNotification: false,
>                       fileName: 'laudo-$id.pdf',
>                     );
>                     Share.shareFiles(['${tempDir.path}/laudo-$id.pdf']);
>                   },
>                 ),
> 

Error in Debug:


I/flutter (23688): Fatal: could not find callback
D/HostConnection(23688): HostConnection::get() New Host Connection established 0x742b683ddb10, tid 23967
D/HostConnection(23688): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
E/EGL_emulation(23688): tid 23737: eglMakeCurrent(1770): error 0x3001 (EGL_NOT_INITIALIZED)
E/libEGL  (23688): eglMakeCurrentImpl:1100 error 3001 (EGL_NOT_INITIALIZED)
E/flutter (23688): [ERROR:flutter/shell/platform/android/android_context_gl.cc(124)] Could not make the context current
E/flutter (23688): [ERROR:flutter/shell/platform/android/android_context_gl.cc(53)] EGL Error: EGL_NOT_INITIALIZED (12289)
E/flutter (23688): [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(235)] Could not make the context current to acquire the frame.
F/flutter (23688): [FATAL:flutter/fml/message_loop.cc(78)] Check failed: loop != nullptr. MessageLoop::EnsureInitializedForCurrentThread was not called on this thread prior to message loop use.
F/libc    (23688): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 23737 (1.raster), pid 23688 (app)```
TheSuperiorStanislav commented 3 years ago

Check out this #445