miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.35k stars 673 forks source link

File not selecting #240

Closed CyberGhost007 closed 4 years ago

CyberGhost007 commented 4 years ago

After allowing permission for the first time, the different screen is opening and the file is not picking for the first time.

miguelpruivo commented 4 years ago

@CyberGhost007 hi. Please, provide the details given on the issue template.

Which platform? Plugin version? Logs? Steps to reproduce? Does that happen on example app?

Thank you.

CyberGhost007 commented 4 years ago

Plugin version: ^1.6.2 Platform: Android

I created one class which opens the file picker to pick document. But for first time it's asks for permission. After allowing it opens different screen(Audio recording) when I press back it shows recent files(Which is correct) but when I tab on that file, it's not picking it. But next time when I run that class. It's working as expected

miguelpruivo commented 4 years ago

This seem to be related to #236. I wasn’t able to replicate it but it seems that migrating your project to fully support V2 Is a must and could help.

Check the troubleshooting for android on this project’s wiki and let me know if it worked for you.

miguelpruivo commented 4 years ago

Any news on this?

CyberGhost007 commented 4 years ago

docFile = await FilePicker.getFile( type: FileType.custom, allowedExtensions: ['pdf', 'doc', 'docx'], );

CyberGhost007 commented 4 years ago

I am using like this

miguelpruivo commented 4 years ago

Hi, can't replicate it. Would you mind to record a video on that happening with the example app? Or it doesn't happen in the example?

Thank you.

CyberGhost007 commented 4 years ago

Okay sure,

CyberGhost007 commented 4 years ago

https://photos.app.goo.gl/a8q5KGDrsZdHaNsa6

Check this video

miguelpruivo commented 4 years ago

@CyberGhost007 this is really weird but I really would like to help you! Could you please all the logs you got until that point?

Thank you.

CyberGhost007 commented 4 years ago

Sure

miguelpruivo commented 4 years ago

@CyberGhost007 sorry to bother, but do you have the logs? That could really help me to follow the stack trace of what's happening that could result in the picker launching the audio recorder (although to me, it looks like the result intent is being picked from the audio recorder — wrongly) and it's not actually related to the File Picker.

Does that device have a custom Android rom?

CyberGhost007 commented 4 years ago

D/FlutterView(15233): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@3c65552 D/SurfaceView(15233): 227862187 updateRequestedVisibility, mViewVisibility:true, mWindowVisibility:false, mWindowStopped:true by android.view.SurfaceView.onWindowVisibilityChanged:292 android.view.View.dispatchWindowVisibilityChanged:13971 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewRootImpl.performTraversals:2334 I/FilePickerDelegate(15233): User cancelled the picker request I/FilePickerDelegate(15233): User cancelled the picker request I/FilePickerDelegate(15233): [SingleFilePick] File URI:content://com.android.providers.downloads.documents/document/939 E/FilePickerUtils(15233): Getting for API 19 or abovecontent://com.android.providers.downloads.documents/document/939 D/SurfaceView(15233): 227862187 updateRequestedVisibility, mViewVisibility:true, mWindowVisibility:false, mWindowStopped:false by android.view.SurfaceView.windowStopped:264 android.view.ViewRootImpl.setWindowStopped:1723 android.view.WindowManagerGlobal.setStoppedState:685 android.app.Activity.performRestart:8055 android.app.ActivityThread.performRestartActivity:5012 android.app.servertransaction.TransactionExecutor.performLifecycleSequence:259 android.app.servertransaction.TransactionExecutor.cycleToPath:217 android.app.servertransaction.TransactionExecutor.executeLifecycleState:189 I/FilePickerDelegate(15233): [SingleFilePick] File URI:content://com.android.providers.downloads.documents/document/939 E/FilePickerUtils(15233): Getting for API 19 or abovecontent://com.android.providers.downloads.documents/document/939 E/FilePickerUtils(15233): Document URI E/FilePickerUtils(15233): Downloads External Document URI D/SurfaceView(15233): 227862187 updateRequestedVisibility, mViewVisibility:true, mWindowVisibility:true, mWindowStopped:false by android.view.SurfaceView.onWindowVisibilityChanged:292 android.view.View.dispatchWindowVisibilityChanged:13971 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewRootImpl.performTraversals:2334 E/FilePickerUtils(15233): Document URI E/FilePickerUtils(15233): Downloads External Document URI I/SurfaceView(15233): 227862187 Changes: creating=true format=false size=false visible=true left=false top=false I/SurfaceView(15233): 227862187 mSurfaceControl 165330751 mBackgroundControl 35835916 creating: SurfaceView - com.workruit/com.workruit.MainActivity I/SurfaceView(15233): 227862187 Cur surface: Surface(name=null)/@0xc2fd2c6, visible=true I/SurfaceView(15233): 227862187 visibleChanged:true -> SurfaceHolder.Callback.surfaceCreated I/SurfaceView(15233): 227862187 surfaceChanged -- format=4 w=1080 h=2400 visibleChanged:true -> SurfaceHolder.Callback.surfaceChanged I/SurfaceView(15233): 227862187 surfaceRedrawNeeded I/SurfaceView(15233): 227862187 finishedDrawing V/SurfaceView(15233): Layout: x=0 y=0 w=1080 h=2400, frame=Rect(0, 0 - 1080, 2400) D/SurfaceView(15233): 239834589 updateSurfacePosition RenderWorker, frameNr = 1, postion = [0, 0, 1080, 2400] D/FlutterView(15233): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@3c65552 I/FilePickerUtils(15233): Caching file from remote/external URI I/FilePickerUtils(15233): Caching file from remote/external URI I/FilePickerUtils(15233): File loaded and cached at:/data/user/0/com.workruit/cache/v4.0b - Push Text Content.docx I/FilePickerDelegate(15233): Absolute file path:/data/user/0/com.workruit/cache/v4.0b - Push Text Content.docx I/FilePickerUtils(15233): File loaded and cached at:/data/user/0/com.workruit/cache/v4.0b - Push Text Content.docx I/FilePickerDelegate(15233): Absolute file path:/data/user/0/com.workruit/cache/v4.0b - Push Text Content.docx E/ANR_LOG (15233): >>> msg's executing time is too long E/ANR_LOG (15233): Blocked msg = { when=-1m20s678ms what=0 target=android.os.Handler callback=io.flutter.embedding.android.FlutterActivityAndFragmentDelegate$2 } , cost = 80642 ms E/ANR_LOG (15233): >>>Current msg List is: E/ANR_LOG (15233): Current msg <1> = { when=-1m20s663ms what=7 target=com.google.android.gms.common.internal.BaseGmsClient$zzb arg2=-1 obj=com.google.android.gms.common.internal.BaseGmsClient$zzg@507f20d } E/ANR_LOG (15233): Current msg <2> = { when=-1m20s658ms what=6 target=android.view.ViewRootImpl$ViewRootHandler } E/ANR_LOG (15233): Current msg <3> = { when=-1m20s650ms barrier=11 } E/ANR_LOG (15233): Current msg <4> = { when=-1m20s208ms what=149 target=android.app.ActivityThread$H obj=android.os.BinderProxy@6c5bf1e } E/ANR_LOG (15233): Current msg <5> = { when=-1m19s625ms what=131 target=android.app.ActivityThread$H obj=android.app.ActivityThread$ProviderRefCount@33035c2 } E/ANR_LOG (15233): Current msg <6> = { when=-1m18s264ms what=0 target=com.google.android.gms.internal.common.zze obj=com.google.android.gms.measurement.START } E/ANR_LOG (15233): Current msg <7> = { when=-20s672ms what=0 target=com.google.android.gms.internal.measurement.zzh callback=com.google.android.gms.measurement.internal.zzad } E/ANR_LOG (15233): Current msg <8> = { when=-5ms what=4 target=android.view.inputmethod.InputMethodManager$H arg1=1 } E/ANR_LOG (15233): Current msg <9> = { when=-3ms what=4 target=android.view.inputmethod.InputMethodManager$H arg1=1 } E/ANR_LOG (15233): Current msg <10> = { when=+57m46s295ms what=0 target=com.google.android.gms.internal.measurement.zzh callback=com.google.android.gms.measurement.internal.zzad } E/ANR_LOG (15233): >>>CURRENT MSG DUMP OVER<<< I/Choreographer(15233): Skipped 4839 frames! The application may be doing too much work on its main thread. I/OpenGLRenderer(15233): Davey! duration=80664ms; Flags=0, IntendedVsync=109389780436218, Vsync=109470430432992, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=109470437576098, AnimationStart=109470437665734, PerformTraversalsStart=109470439233442, DrawStart=109470441863754, SyncQueued=109470441890994, SyncStart=109470442477244, IssueDrawCommandsStart=109470442756307, SwapBuffers=109470444534379, FrameCompleted=109470445477817, DequeueBufferDuration=832000, QueueBufferDuration=682000, W/FA (15233): Tasks have been queued for a long time I/flutter (15233): Sending report to sentry.io Instance of 'Event' W/System (15233): A resource failed to call close. W/System (15233): A resource failed to call close. `

CyberGhost007 commented 4 years ago

@miguelpruivo Sorry for the delay. Here are the logs.

CyberGhost007 commented 4 years ago

@miguelpruivo Any updates on this?

miguelpruivo commented 4 years ago

@CyberGhost007 I still have to look into it. I'll keep you updated.

CyberGhost007 commented 4 years ago

Perfect, thanks

miguelpruivo commented 4 years ago

@CyberGhost007 does that happen on a different device? Are you able to replicate it on an emulator? I can't really understand what's happening and by the logs the files are being picked properly, but, somehow, the audio player on your system picks the same intent result which is odd and seems like a bad implementation of intent handler on recorder.

CyberGhost007 commented 4 years ago

It's Color OS 7. I can replicate in my Oppo Reno 2

miguelpruivo commented 4 years ago

@CyberGhost007 same thing. Those devices don’t have official Android versions afaik. But I can’t replicate on emulator which is what I have. If you are able to replicate on any emulator please let me know the specs so I can try it out.

Thanks!

CyberGhost007 commented 4 years ago

Great, thanks man. I'll test again in stock android.

miguelpruivo commented 4 years ago

Just let me know if it worked for you @CyberGhost007.

CyberGhost007 commented 4 years ago

Sure sure, will try in morning. I'll let you know. Thanks for support :)

miguelpruivo commented 4 years ago

@CyberGhost007 any news regarding this?

CyberGhost007 commented 4 years ago

Hey, ah no. I think not facing the issue now:) thanks for your time and a great library.

BytesZero commented 4 years ago

@miguelpruivo adb push file cannot be selected

miguelpruivo commented 4 years ago

@yy1300326388 what do you mean?

BytesZero commented 4 years ago

@miguelpruivo image

BytesZero commented 4 years ago

I use the adb push command to copy to sdcard/Download, and then after I select the file, the file cannot be returned.

D/FilePickerDelegate(12100): Selected type */*
D/CrashReport(12100): >>> com.banjixiaoguanjia.app.MainActivity onPaused <<<
I/CrashReport-Native(12100): Set native info: isAppForeground(false)
I/Choreographer(12100): Skipped 3 frames!  The application may be doing too much work on its main thread.
E/FirebaseInstanceId(12100): Google Play services missing or without correct permission.
I/FilePickerDelegate(12100): User cancelled the picker request
D/CrashReport(12100): >>> com.banjixiaoguanjia.app.MainActivity onResumed <<<
I/CrashReport-Native(12100): Set native info: isAppForeground(true)
I/Choreographer(12100): Skipped 1 frames!  The application may be doing too much work on its main thread.
I/Choreographer(12100): Skipped 1 frames!  The application may be doing too much work on its main thread.
BytesZero commented 4 years ago

I restarted the phone and it was fine, thank you very much @miguelpruivo

miguelpruivo commented 4 years ago

I did nothing ahah no problem @yy1300326388 glad that a reboot worked for you.