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.34k stars 673 forks source link

column '_data' does not exist when picking from Dropbox #76

Closed apps-transround closed 5 years ago

apps-transround commented 5 years ago

When picking from Dropbox on Android there is a deterministic crash with ...MainActivity}: java.lang.IllegalArgumentException: column '_data' does not exist

I guess this is the same issue as it was for image picker: https://github.com/flutter/plugins/pull/772 Fix: https://github.com/flutter/plugins/pull/772/commits/8e380534f1f0b7f25219b23288d1c2dd274e92cf

miguelpruivo commented 5 years ago

Probably will be the same, since they share underlying platform code for picking files. I'll add this for the 1.4.0 roadmap.

Thank you for reporting.

miguelpruivo commented 5 years ago

@apps-transround just released a fix for this in beta. Could you please give it a try and let me know if it's working for you? Just replace the file_picker: 1.3.6 in your pubspec.yaml with the following:

  file_picker:
    git:
      url: https://github.com/miguelpruivo/plugins_flutter_file_picker.git
      ref: beta

Thank you!

thesmalleyes commented 5 years ago

@apps-transround just released a fix for this in beta. Could you please give it a try and let me know if it's working for you? Just replace the file_picker: 1.3.6 in your pubspec.yaml with the following:

  file_picker:
    git:
      url: https://github.com/miguelpruivo/plugins_flutter_file_picker.git
      ref: beta

Thank you!

i have tried this way, but nothing changes. it crashes again if i choos dropbox

miguelpruivo commented 5 years ago

@bayuramadeza you need to make sure you do a flutter clean and then rebuild.

Also, if the same happens post your logs please. It shouldn’t happen with that version as the fix is already applied.

Thank you.

thesmalleyes commented 5 years ago

@bayuramadeza you need to make sure you do a flutter clean and then rebuild.

Also, if the same happens post your logs please. It shouldn’t happen with that version as the fix is already applied.

Thank you.

So, after i tried, this is happened Failure delivering result ResultInfo{who=null, request=38442, result=-1, data=Intent { dat=content://com.dropbox.android.FileCache/filecache/9c6a764d-5d39-4d45-8ac3-e163df38d77d typ=application/pdf flg=0x3 }} to activity {com.example.MainActivity}: java.lang.IllegalArgumentException: column '_data' does not exist E/AndroidRuntime( 6869): at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:339) E/AndroidRuntime( 6869): at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87) E/AndroidRuntime( 6869): at com.mr.flutter.plugin.filepicker.FileUtils.getDataColumn(FileUtils.java:133) E/AndroidRuntime( 6869): at com.mr.flutter.plugin.filepicker.FileUtils.getForApi19(FileUtils.java:114) E/AndroidRuntime( 6869): at com.mr.flutter.plugin.filepicker.FileUtils.getPath(FileUtils.java:29) E/AndroidRuntime( 6869): at com.mr.flutter.plugin.filepicker.FilePickerPlugin$1.onActivityResult(FilePickerPlugin.java:78) E/AndroidRuntime( 6869): at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:204) E/AndroidRuntime( 6869): at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:132) E/AndroidRuntime( 6869): at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:142) E/AndroidRuntime( 6869): at android.app.Activity.dispatchActivityResult(Activity.java:7121) E/AndroidRuntime( 6869): at android.app.ActivityThread.deliverResults(ActivityThread.java:4175) E/AndroidRuntime( 6869): ... 9 more I/Process ( 6869): Sending signal. PID: 6869 SIG: 9 Lost connection to device.

miguelpruivo commented 5 years ago

@bayuramadeza thank you for you fast response. Just committed a new fix, can you flutter clean and build again and let me know if it's working now? Also, I would suggest you to remove the .pub_cache/git to make sure it is fetching the new version.

thesmalleyes commented 5 years ago

@bayuramadeza thank you for you fast response. Just committed a new fix, can you flutter clean and build again and let me know if it's working now? Also, I would suggest you to remove the .pub_cache/git to make sure it is fetching the new version.

Thank you @miguelpruivo , it's work now.

miguelpruivo commented 5 years ago

I thank you @bayuramadeza for your cooperation. Glad it’s working now.

Just let me know if you find any other issue. I’ll deploy a new version on pub.dev with this and other fixed by the end of the week and close this afterwards.

Once more, thank you for reporting.

thesmalleyes commented 5 years ago

hai @miguelpruivo i think there is a new issues while we pick a file from (Oppo colorOS) Filemanager, it is happening now Fatal Exception: java.lang.RuntimeException Failure delivering result ResultInfo{who=null, request=39027, result=-1, data=Intent { act=android.intent.action.SEND dat=content://com.coloros.filemanager/file_share/storage/emulated/0/AGroupCompressPDF/2019_test.pdf flg=0x1 (has extras) }} to activity {com.topkarir.topkarir/com.topkarir.topkarir.MainActivity}: java.lang.IllegalArgumentException: column '_data' does not exist

miguelpruivo commented 5 years ago

@bayuramadeza this have happened before with some other custom rom and actually doubt if I can do anything about it as of now.

Those file managers from those roms handle the file in a way that don’t return a valid path of the picker file.

You can try to install a different file explorer and see if by using it, it works for you.

Thank you.

miguelpruivo commented 5 years ago

Fixed in 1.3.7.