-
Notifications
You must be signed in to change notification settings - Fork 54
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
File not found (Android) #235
Comments
Hello @jdwirrenga, Can you send us your Regards, |
I am using latest version of ionic capacitor so there is no config.xml, so let me know what you're looking for and I can send that as well. I originally had the cordova-plugin-background-upload package instead of the @spoonconsulting one but I could not get it to build on android because of old versions of things. |
Hello @jdwirrenga, As you are using capacitor, you can send us the Also are you using this package Also let us know which version of XCode, iOS, Emulator Device, ... you are using. Regards, |
@zafirskthelifehacker I am using the @awesome-corodova-plugins package. I tried removing it and importing from @spoonconsulting but I can't get ionic to recognize it as a module. I know for a fact I tried not using @spoonconsulting and nothing would even compile. I also tried following the readme to set up the uploader but couldn't get any of that to work. All the xcode emulators and the iPad I ran it on seem to work. What failed was running it in Android on an actual device we use for testing that is running Android 11 right now. My config:
Here is the relevant code where I am actually doing the upload
|
Hello @jdwirrenga, Based on the error, the path that is given from the capacitor is not recognized by the native side for Android. To fix that you can use Regards, |
@zafirskthelifehacker I tried file.moveFile to file.dataDirectory but it still was unable to upload the file. Why does it always look in the /cdvfile_sdcard/ directory even when you pass in the file such as file:///data/user/0/com.name.app/files/VID_20220726_085410110.mp4? I noticed that if you get the fileEntry and do toInternalURL() or toURL() that they give you this same path effectively, Ex: http://localhost/__cdvfile_files__/VID_20220726_085410110.mp4 I tried using nativeURL as well with the same error.
Whose output looks like:
|
Hello @jdwirrenga, As what I am seeing, you are passing
Something like this. Regards, |
@zafirskthelifehacker I tried all of them including nativeURL, they all give the same error. Which is to say neither |
Hello @jdwirrenga, Have you request the permission You can try to use Regards, |
@zafirskthelifehacker this is what I have for permissions in the android app so far:
As I look at my AndroidManifest.xml I do notice this
Is it possible I need something similar for the background upload with the |
Hello @jdwirrenga, You can try the Have you tried an image file(jpg, png, ...)? If not, you can try this and let me know. Regards, |
@zafirskthelifehacker Tried on a Pixel 5 as well and got the same error. Tried a jpg and got the same error. |
Hello @jdwirrenga, Try to add Regards, |
@zfir I added that line and two others to my manifest so that it looks like below, but am still getting the error.
|
@zfir I found this stackoverflow about using old storage while targeting version 30 or higher...I am targeting 31 which I believe I had to in order to even get this package to compile in Android: |
Hello @jdwirrenga, Have you found the fix? Based on this StackOverflow, Google suggested to use MANAGE_EXTERNAL_STORAGE permission(https://developer.android.com/training/data-storage/manage-all-files). You can try that also. Regards, |
@zfir No I haven't found a fix. I added the MANAGE_EXTERNAL_STORAGE permission but that did not help. I suspect a workaround would be to find a version which allows me to bump android down to 29 but still new enough to prevent other problems. I think maybe I will just take the time to make a repo you can checkout and test the error yourself. However, it might be a little while before I have time to do so. |
@zfir I had a little time to set the repo up. I must be missing one piece though because it does everything except actually kick off the upload it seems. But if that one issue was fixed it should be an exact repro of my issue. |
Hello @jdwirrenga, I am getting this error when running on Android: Regards, |
@zfir where did you see this error at? I could not repro on my machine. I did however add the package to the repo but I'm still getting the same thing in the output where it gets to this line Which should be followed immediately by the error but no error. Just in case I tried adding the core package to my actual project as well to see if that resolved the error and it did not. |
Hello @jdwirrenga, When doing Regards, |
@zfir I typically run on an android device by first opening Android Studio with It really bothers me the repo I made doesn't hit the error like the actual project does. It seems like it doesn't actually "do work" or something like it should. Not sure what the different between the two is. I can't get the repo to hit an endpoint or anything. |
Hello @jdwirrenga, So this repository is not getting the same file path error as your actual project? This repository does not start the uploads based on your comments. I would recommend you to include Logs in the Background Upload Plugin and checks where it stops. As for running your repository Regards, |
@jdwirrenga Did you manage to solve the problem? I have the same error I also use capacitor but sdk version 32 |
@ckamil unfortunately I have not had more time to look into this error. We have been focusing on launching for iOS so this was put on the backburner. I still suspect that there is a magic version number between Android and the plugin that just needs to be found. I don't think it is a permissions problem anymore. I think the location of things has simply changed. If you find the solution please let us know! Feel free to use that repo I made to test things out. @zfir if is it determined that the file system has simply changed and it is not a permissions problem, what are the chances an update can be made to the plugin? |
Hello @jdwirrenga, We are already building a cordova app with SDK Build Tools 30 with no problems. When upgrading to SDK Build Tools 32 if we overcome any problem, we will surely fix the plugin. If ever you are able to find any solution, pull requests are most welcome. Regards, |
@jdwirrenga @zfir thanks for the reply, unfortunately I can't go lower with the SDK, so it will be nice if there is a fix in the near future |
@jdwirrenga @zfir the problem is here FileTransferManager.js#L54 when I replace to then the upload works properly |
@jdwirrenga url in the form file:///data/user/0/com.example/files/photo_0__1664542670860.png taken from the Filesystem.writeFile method |
Hello @jdwirrenga @ckamil, @ckamil Nice. I would recommend you to submit a PR, we will try to review and merge it as fast as we can. Thanks. Regards, |
@zfir I do not know what exactly should be here, in my app I have so:
|
Hello @ckamil I think for the android part, it should be something like: Try this and let me know. Regards, |
@zfir this won't work because entry.toURL() returns the wrong url:
|
@ckamil Create a PR with changes that you have made. I will test and let you know. |
@dennismuench might you have a solution for this? I see you are the last commit for this line of code. |
Hi @zfir & @jdwirrenga - I just got my app uploading 🚀 (after 2 days of suffering haha) Firstly, I just add
My implementation is an Ionic web app, I'm using Capacitor, but I am using this Cordova plugin to talk to the backgrounding: Here are my wrappers that talk to the plugin:
|
changes for support android 11+ and cordova-plugin-file v7.0.0 |
I am getting a File not found error running on Android that I am not getting in iOS when running a sim from xCode.
Here is the output:
I am not sure what is converting "file:///storage/emulated/0" to "cdvfile_sdcard" in the filepath but that seems like it might be a problem? Additionally, maybe the file system on the computer via the ios sim is simply not a valid sim of what it will be on an actual iOS device and it will fail in there as well.
I have also tried files paths without the "file://" appended to the front, and with the capacitor localhost file thing
Capacitor.convertFileSrc(uri)
but these don't seem to work.The text was updated successfully, but these errors were encountered: