luisfuertes / react-native-file-picker

File Picker for React Native
67 stars 32 forks source link

App crashes in Android version 8.0.0 #15

Closed durgarao150 closed 6 years ago

durgarao150 commented 6 years ago

On selecting any file in Android 8.0.0 the app is crashing

kholiavko-roman commented 6 years ago

I have the problem when I selected 'docx' or 'doc' file and 'txt', but 'pdf' works fine. Here is logs:

01-10 16:16:51.485 12727 12727 D AndroidRuntime: Shutting down VM
01-10 16:16:51.485 12727 12727 E AndroidRuntime: FATAL EXCEPTION: main
01-10 16:16:51.485 12727 12727 E AndroidRuntime: Process: com.test.app, PID: 12727
01-10 16:16:51.485 12727 12727 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { dat=content://com.android.providers.downloads.documents/document/raw:/storage/emulated/0/Download/teeststst.docx flg=0x1 }} to activity {com.test.app/com.test.app.MainActivity}: java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/teeststst.docx"
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.app.ActivityThread.deliverResults(ActivityThread.java:4268)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.app.ActivityThread.-wrap19(Unknown Source:0)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:164)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6494)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
01-10 16:16:51.485 12727 12727 E AndroidRuntime: Caused by: java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/teeststst.docx"
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at java.lang.Long.parseLong(Long.java:590)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at java.lang.Long.valueOf(Long.java:804)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.filepicker.FilePickerModule.getPath(FilePickerModule.java:172)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.filepicker.FilePickerModule.onActivityResult(FilePickerModule.java:132)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.filepicker.FilePickerModule.onActivityResult(FilePickerModule.java:111)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:256)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.facebook.react.ReactInstanceManager.onActivityResult(ReactInstanceManager.java:656)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:149)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.app.Activity.dispatchActivityResult(Activity.java:7266)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
01-10 16:16:51.485 12727 12727 E AndroidRuntime:    ... 9 more
01-10 16:16:51.488   767  1549 W ActivityManager:   Force finishing activity com.test.app/.MainActivity
01-10 16:16:51.494   767   783 I ActivityManager: Showing crash dialog for package com.test.app u0
01-10 16:16:51.530   767  5610 I OpenGLRenderer: Initialized EGL, version 1.4
01-10 16:16:51.531   767  5610 D OpenGLRenderer: Swap behavior 2
01-10 16:16:51.991   767   782 W ActivityManager: Activity pause timeout for ActivityRecord{ee04233 u0 com.test.app/.MainActivity t2214 f}

@luisfuertes can you help us please ?

android 8.1.0 react-native 0.47

kholiavko-roman commented 6 years ago

Also I tested 'docx' on android 7.0 and it works.

Vetalyo commented 6 years ago

I have the same problem, any ideas?

luisfuertes commented 6 years ago

I'll try to fix it over the weekend

kholiavko-roman commented 6 years ago

@luisfuertes, any updates about this problem ?

kholiavko-roman commented 6 years ago

ping @luisfuertes

luisfuertes commented 6 years ago

v0.0.11 published with @DragonSpirit merge. Thanks for PR