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

v1.0rc2 breaks on Android #148

Closed
outerbound opened this issue Nov 10, 2015 · 13 comments
Closed

v1.0rc2 breaks on Android #148

outerbound opened this issue Nov 10, 2015 · 13 comments

Comments

@outerbound
Copy link

I upgraded to v1.0rc2. Imgcache is totally broken on Android. I checked logs, Why is cdvfile:// coming for Android? I reverted back to v1.0rc1 and things are back to normal.

rc2 log

INFO: ImgCache initialising
INFO: LocalFileSystem opened
INFO: Local cache folder opened: cdvfile://localhost/persistent/ImgCache/
INFO: .nomedia file created.
cdvfile://localhost/persistent/ImgCache/31ce96647d9ebd5b22332116d74232a03bca3fbd.jpg Failed to load resource: the server responded with a status of 404 (Not Found)
cdvfile://localhost/persistent/ImgCache/a797e4a94395220a55f99135604f4f26779eb353.png Failed to load resource: the server responded with a status of 404 (Not Found)

rc1 log

INFO: ImgCache initialising
INFO: LocalFileSystem opened
INFO: Local cache folder opened: file:///storage/emulated/0/ImgCache/
INFO: .nomedia file created.

@chrisben
Copy link
Owner

I suppose this is a regression caused by this change:
9160fb4
That seemed to fix things for some people (see #97)

Could you please:

  • state the version of Android you're using
  • state the version of Cordova / File plugin
  • try to comment lines 177 to 179 of imgcache.js to see if it works without

@ksibod
Copy link

ksibod commented Nov 19, 2015

I'm not sure if @outerbound was able to fix their issue or not, but I was having the same problem. @chrisben You are correct that commenting out the three lines added in 9160fb4 solved the issue.

This is with:

  • Android 5.0.2
  • Cordova Android - 5.0.0
  • File Plugin - 3.0.0

@chrisben
Copy link
Owner

Thanks @ksibod for the feedback!
Perhaps then those lines of code should only be kept for iOS then.. Reading the comments on #97 suggests most people saying it fixed their problems were iOS user.
@ksibod or @outerbound : would you be able to test your application on iOS ?

@eekilli
Copy link

eekilli commented Nov 20, 2015

Hi, maybe not completely related to this issue, but I was having 404 errors using ImgCache on Android (4.0+) with Cordova 5. After much trial and error I found the solution of adding
<access origin="cdvfile://*" /> to my config.xml. (If you use the whitelist plugin you probably have to add <allow-intent href="cdvfile://*" /> as well)

I could not find anything about this in the CORDOVA.md, so would be nice if someone could add this to prevent anyone else having the same headache :)

@ksibod
Copy link

ksibod commented Nov 20, 2015

@chrisben No problem!
I did test this on iOS as well. For my application, there was no error either way. Commenting those lines out didn't change anything at all. This was on an iPhone 6 with iOS 9.1.

@JumpLink
Copy link

Same problem and fixed with @eekilli's solution (I havn't comment out anything), thank you!
See also this similar issue.

I think this issue is resolved?

@SamVerschueren
Copy link

I confirm adding <access origin="cdvfile://*" /> to the config.xml file fixes this problem.

@chrisben
Copy link
Owner

Great, I'm adding this info to the documentation. Thanks @eekilli

@vdias38
Copy link

vdias38 commented May 1, 2016

I still observe this issue. I've migrated from imgcache.js#v1.0rc1 to imgcache.js#v1.0.0 and stop working on Android. Works well on iOS. If I do the reverse migration, re-install version 1.0rc1 it works back.
I've tested with phonegap cli-6.0.0 (Android 5.1.0) and File plugin 4.1.0.
My device run with Android 4.1.
On my config.xml I've setted both lines:

<access origin="cdvfile://*" />
<allow-intent href="cdvfile://*" />

Can't see errors in logs

[phonegap] [console.log] INFO: ImgCache initialising
[phonegap] [console.log] INFO: LocalFileSystem opened
[phonegap] [console.log] INFO: Local cache folder opened: cdvfile://localhost/persistent/imgcache/
[phonegap] [console.log] INFO: .nomedia file created.

@chrisben
Copy link
Owner

@elbidone would that be possible for you to track when that regression occurred by testing the successive commits following rc1? You can use dichotomy to speed up the process there.
Sorry I make you work there, but I don't have all the environment to reproduce your issue.

@chrisben chrisben reopened this May 14, 2016
@vdias38
Copy link

vdias38 commented May 16, 2016

Hi @chrisben, I've finally found the issue.

After days of investigation (I've tested various versions of phonegap and File plugin), the solution comes from a PhoneGap Community Issue: cdvfile throws 404 not found error in Phonegap 5.1.1 .
It only works for me if I declare on my config.xml:

<access origin="cdvfile://*" />
<allow-navigation href="cdvfile://*" />

If I remove <allow-navigation href="cdvfile://*" /> it raises 404.

I didn't need to add cdvfile scheme on my CSP or <allow-intent href="cdvfile://*" /> on my config.xml.
Below my CSP.

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src self' 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; img-src * filesystem:;">

Thanks for your reply, this issue was an opportunity do dig deeper into imgcache.js code, congratulations it's very well implemented and commented!!

@chrisben
Copy link
Owner

@elbidone Thanks for sharing your findings with us, hope this will help other people in the same case.

@badpenguin
Copy link

badpenguin commented Jan 27, 2017

Well.... i've this same problem and reverted back to rc1.
I've tried rc2 just now with ionic2 because i was happy with the old 0.xx release i was using with ionic1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants