Hi There, we are using <this library> to pick file, and images, unfortunately we are seeing this exc...
s
Hi There, we are using this library to pick file, and images, unfortunately we are seeing this exception, can someone help to check
@mohamed rejeb
Copy code
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1548766137, result=-1, data=Intent { dat=<content://com.android.providers.downloads.documents/document/raw:/storage/emulated/0/Download/ncert.pdf> flg=0x1 }} to activity {xyz.penpencil.unigo/com.myapplication.MainActivity}: java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/ncert.pdf"
                                                                                                    	at android.app.ActivityThread.deliverResults(ActivityThread.java:5340)
                                                                                                    	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5379)
                                                                                                    	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
                                                                                                    	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                    	at android.os.Looper.loop(Looper.java:288)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7842)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
                                                                                                    Caused by: java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/ncert.pdf"
                                                                                                    	at java.lang.Long.parseLong(Long.java:594)
                                                                                                    	at java.lang.Long.valueOf(Long.java:808)
                                                                                                    	at com.mohamedrejeb.calf.picker.URIPathHelper.getPath(UriHelper.kt:30)
                                                                                                    	at com.mohamedrejeb.calf.picker.FilePickerLauncher_androidKt$pickSingleFile$singlePhotoPickerLauncher$1.invoke(FilePickerLauncher.android.kt:138)
                                                                                                    	at com.mohamedrejeb.calf.picker.FilePickerLauncher_androidKt$pickSingleFile$singlePhotoPickerLauncher$1.invoke(FilePickerLauncher.android.kt:135)
                                                                                                    	at androidx.activity.compose.ActivityResultRegistryKt$rememberLauncherForActivityResult$1.invoke$lambda$0(ActivityResultRegistry.kt:106)
                                                                                                    	at androidx.activity.compose.ActivityResultRegistryKt$rememberLauncherForActivityResult$1.$r8$lambda$CrhP0xb3HsgP_dLwJEFAtzTwPms(Unknown Source:0)
                                                                                                    	at androidx.activity.compose.ActivityResultRegistryKt$rememberLauncherForActivityResult$1$$ExternalSyntheticLambda0.onActivityResult(Unknown Source:2)
                                                                                                    	at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:414)
                                                                                                    	at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:371)
                                                                                                    	at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:845)
                                                                                                    	at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:152)
                                                                                                    	at android.app.Activity.dispatchActivityResult(Activity.java:8385)
                                                                                                    	at android.app.ActivityThread.deliverResults(ActivityThread.java:5333)
                                                                                                    	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5379)
                                                                                                    	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
                                                                                                    	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                    	at android.os.Looper.loop(Looper.java:288)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7842)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
c
Long code snippets should go in the thread here to not clutter the main thread.
👍 1
and your issue is that
raw:/storage/emulated/0/Download/ncert.pdf
in not a number. check who and where the parsing is happening.
your intent is having a data block
Copy code
<content://com.android.providers.downloads.documents/document/raw:/storage/emulated/0/Download/ncert.pdf>
like from a content provider and I guess that expects an “id” instead if your
raw
url.
I’d file an issue in the repo with the android version you are seeing this issue, maybe its not compatible with your android version.
s
we raised it here @Chrimaeon
c
You just posted a stack trace 😅 nice bug report! 🙈
s
oops 😛 let us add more details...
added details
@Chrimaeon any workaround for this issue we could try
c
🚫
🙃 1