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

Filesystem.copy not working con content:/ android #2087

Closed
massimoliani opened this issue Apr 18, 2024 · 1 comment
Closed

Filesystem.copy not working con content:/ android #2087

massimoliani opened this issue Apr 18, 2024 · 1 comment

Comments

@massimoliani
Copy link

Bug Report

Plugin(s)

Filesystem copy function

Capacitor Version

Latest Dependencies:

@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/android: 6.0.0
@capacitor/ios: 6.0.0

Installed Dependencies:

@capacitor/cli: 5.7.4
@capacitor/core: 5.7.4
@capacitor/android: 5.7.4
@capacitor/ios: 5.7.4

Platform(s)

Android

Current Behavior

I'm trying to copy a video or picture file selected with @capawesome/capacitor-file-picker the returned path is in the form content:/....provider..../name....
When starting the copy I got an error from bridge that let the android app crash immediately.

Expected Behavior

I expect the video file can be copied to local app folder like documents or data.

Code Reproduction

Using file picker you can pick a video file from the gallery and try to copy it to app documents.

Other Technical Details

I test it on API30 and API33 but the result is the same.

Additional Context

This is the error and exception letting the app to crash:
Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:800)
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
at com.capacitorjs.plugins.filesystem.Filesystem.getDirectory(Filesystem.java:203)
at com.capacitorjs.plugins.filesystem.Filesystem.getFileObject(Filesystem.java:227)
at com.capacitorjs.plugins.filesystem.Filesystem.copy(Filesystem.java:109)
at com.capacitorjs.plugins.filesystem.FilesystemPlugin._copy(FilesystemPlugin.java:430)
at com.capacitorjs.plugins.filesystem.FilesystemPlugin.copy(FilesystemPlugin.java:381)
at java.lang.reflect.Method.invoke(Native Method) 
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138) 
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:800) 
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0) 
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8) 
at android.os.Handler.handleCallback(Handler.java:938) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:223) 
at android.os.HandlerThread.run(HandlerThread.java:67) 
2024-04-18 22:57:35.221 21631-21924 AndroidRuntime it.skirankapp.official E FATAL EXCEPTION: CapacitorPlugins
Process: it.skirankapp.official, PID: 21631
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:809)
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:800)
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0) 
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8) 
at android.os.Handler.handleCallback(Handler.java:938) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:223) 
at android.os.HandlerThread.run(HandlerThread.java:67) 
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
at com.capacitorjs.plugins.filesystem.Filesystem.getDirectory(Filesystem.java:203)
at com.capacitorjs.plugins.filesystem.Filesystem.getFileObject(Filesystem.java:227)
at com.capacitorjs.plugins.filesystem.Filesystem.copy(Filesystem.java:109)
at com.capacitorjs.plugins.filesystem.FilesystemPlugin._copy(FilesystemPlugin.java:430)
at com.capacitorjs.plugins.filesystem.FilesystemPlugin.copy(FilesystemPlugin.java:381)
at java.lang.reflect.Method.invoke(Native Method) 
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138) 
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:800) 
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0) 
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8) 
at android.os.Handler.handleCallback(Handler.java:938) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:223) 
at android.os.HandlerThread.run(HandlerThread.java:67) 

Thank you very much

@IT-MikeS
Copy link
Contributor

This relates to another plugin and not one in this repo. Closing

@ionic-team ionic-team locked as off-topic and limited conversation to collaborators May 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants