Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen Turn to black when selecting big file #69

Closed
ayalma opened this issue Apr 14, 2019 · 22 comments
Closed

Screen Turn to black when selecting big file #69

ayalma opened this issue Apr 14, 2019 · 22 comments
Labels

Comments

@ayalma
Copy link

ayalma commented Apr 14, 2019

Hi and Thank you for you'r plugin
When trying to select big file in android screen turn's to black. (app not responding like act)

@miguelpruivo
Copy link
Owner

Hi @ayalma are you selecting it from cloud?

@ayalma
Copy link
Author

ayalma commented Apr 14, 2019

No , i selecting it from my local storage

@miguelpruivo
Copy link
Owner

miguelpruivo commented Apr 14, 2019

If you give it sometime, does it load the path? If it was from a cloud it would make sense because you have to give it sometime (synchronously) to cache the file. Locally, it shouldn’t be an issue.

I need you to provide more details. Post the output of your flutter doctor -v and also the steps to reproduce this issue.

@ayalma
Copy link
Author

ayalma commented Apr 14, 2019

When i'm selecting small file's the black screen not appearing
And when i'm selecting big file after giving a enough time it load file path but screen turn's to black when the caching stuff runs in app

The example application in you'r repo is reproduce the error just select big file
And for flutter output

[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.1 18B75, locale en-IR)
    • Flutter version 1.2.1 at /Users/ali/Documents/Flutter
    • Framework revision 8661d8aecd (8 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/ali/Documents/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/ali/Documents/Android/Sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[!] VS Code (version 1.31.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • HUAWEI MLA L11               • • android-arm64 • Android 7.0 (API 24)
    • Android SDK built for x86 64 • emulator-5554    • android-x64   • Android 7.1.1 (API 25) (emulator)

! Doctor found issues in 2 categories.

Thank you in advance

@miguelpruivo
Copy link
Owner

miguelpruivo commented Apr 14, 2019

Well, as of now this is the correct behavior because the file needs to be fully loaded before actually accessing it, that’s why this is synchronous and you see the black screen while it’s awaiting the path to load.

Can I ask you how big the file is? Nevertheless, I may take a look into it later.

Edit: Also @ayalma, it would be great if you could post the full log of when you load a big file.

@ayalma
Copy link
Author

ayalma commented Apr 15, 2019

I tested it with file size about 300 mb
and i get this log

I/FilePicker(19909): Checking permission: android.permission.WRITE_EXTERNAL_STORAGE
I/FilePicker(19909): [SingleFilePick] File URI:content://com.android.providers.downloads.documents/document/1702
E/FilePickerUtils(19909): Getting for API 19 or abovecontent://com.android.providers.downloads.documents/document/1702
E/FilePickerUtils(19909): Document URI
E/FilePickerUtils(19909): Downloads External Document URI
E/FilePickerUtils(19909): Something went wrong while retrieving document path: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/1702
E/FilePickerUtils(19909): Something went wrong while retrieving document path: java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/all_downloads/1702 from pid=19909, uid=10587 requires android.permission.ACCESS_ALL_DOWNLOADS, or grantUriPermission()
I/FilePickerUtils(19909): Remote file loaded and cached at:/data/user/0/com.sabzafzar.gss1/cache/Lynda.Scrum.Advanced_p30download.com.part2.rar
I/FilePicker(19909): Absolute file path:/data/user/0/com.sabzafzar.gss1/cache/Lynda.Scrum.Advanced_p30download.com.part2.rar
I/OpenGLRenderer(19909): Initialized EGL, version 1.4

It's somthing about permission
and i have this
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
in my manifest

@miguelpruivo
Copy link
Owner

Hi @ayalma, it has nothing to do with permission. At this point, you should be fine only with WRITE_EXTERNAL_STORAGE because I'm assuming that your app already has the INTERNET permission, if not, you may add it as well.

Nevertheless, by looking at your log I can see that it is actually caching the file (thus, creating a file of 300 MB, that's why it takes longer) probably because the device doesn't have it available locally to use. This may happen when you select file from recently used files in Android where it gives you the idea that is there, but might have been already removed by the system.

In the file picker, which folder are you selecting?

@ayalma
Copy link
Author

ayalma commented Apr 15, 2019

Hi , I have Internet permission
I'm selecting file form downloads folder
For testing purpose i cloned and tested this repo
and when i'm selecting big file there is no black screen

@miguelpruivo
Copy link
Owner

miguelpruivo commented Apr 15, 2019

@ayalma and are you getting the same path with that? As I pointed before, looks like the file is being copied locally (300 mb) so that's why it takes longer as this process is made synchronously.

Would you mind to copy that file to another local folder and select it again (from other folder, instead donwloads)? Let me know if it works.

@ayalma
Copy link
Author

ayalma commented Apr 15, 2019

The library i mentioned above act same as your lib and copy data to cache , but it cache files asynchronously i think

@miguelpruivo
Copy link
Owner

@ayalma can you try to do what I've asked to?

It would help me to understand more precisely what's actually happening.

Thank you.

@ayalma
Copy link
Author

ayalma commented Apr 16, 2019 via email

@miguelpruivo
Copy link
Owner

@ayalma ok, so basically, the downloads folder that you are using hasn't the file locally stored and has to download it again, that's why it takes sometime and thus the black screen.

Making it async, would mean that an user could potentially use the path without the file being yet completely loaded, which would lead to undefined behaviors (or mostly an exception).

What if you don't use await getFilePath and instead do getFilePath().then((path) => print(path));?

@VyasPrachi
Copy link

Hello,
When I had clicked on the button there is nothing happen. Please help me out

@miguelpruivo
Copy link
Owner

@VyasPrachi this is too vague. I need more info in order to help you. Is it related to this issue?

@ayalma since I don't have a reply from you, I'll close this issue in the upcoming days.

@VyasPrachi
Copy link

Hello @miguelpruivo,
Sorry for the late reply. Photo clicked by the back camera is not taking but the photo clicked by the front camera is taken. So maybe I think this is an image size issue.

@miguelpruivo
Copy link
Owner

miguelpruivo commented Apr 30, 2019

@VyasPrachi how many issues do you have? You should move this to your own issue.

Which version are you using? This package doesn’t support picking for camera since 1.3.0.

@VyasPrachi
Copy link

Hi @miguelpruivo,
Sorry for the trouble but I am new in flutter development. So I have asked when I am facing any problem.

@miguelpruivo
Copy link
Owner

@VyasPrachi is this fixed for you?

@miguelpruivo
Copy link
Owner

@VyasPrachi what do you mean by capture? This package doesn't allow taking pictures at all. Are you talking about selecting the file?

@VyasPrachi
Copy link

Hello @miguelpruivo,
I am talking about the plugin that is not allowed to take the file from picker but when I have given storage permission it gives access. So Now my issue is solved. Thank You for your response.

@miguelpruivo
Copy link
Owner

Yes @VyasPrachi , you must give storage access permission.
Glad that is working now.

@ayalma feel free to reopen this if you are still experiencing any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants