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

Assets-related crashes after update on Android #183

Closed
mhagmajer opened this issue Feb 4, 2016 · 5 comments
Closed

Assets-related crashes after update on Android #183

mhagmajer opened this issue Feb 4, 2016 · 5 comments

Comments

@mhagmajer
Copy link

After updating react-native to 0.19.0 and react-native-code-push to 1.7.1-beta, any code pushes to my app caused it to crash. Java exceptions were related to the app not being able to find the bundled resources. I followed the instructions carefully making sure that the JS bundle file is named correctly and that all the assets were bundled along and that code-push sent them to the app just fine. This crash also made the app unable to receive any additional updates...

I solved the problem by moving all static image resources to Android drawable resources and publishing a new version in the Play store. I'm not able to code-push any additional assets though which is a bummer...

@lostintangent I think this is related to the recent support for bundling assets for Android. How can we debug this more?

@geof90
Copy link
Contributor

geof90 commented Feb 4, 2016

Could we see the exception thrown? That could be helpful!

@geof90
Copy link
Contributor

geof90 commented Feb 4, 2016

Also, how did you update to react-native 0.19.0? did you use the react-native upgrade command? My quick guess could be that Gradle is still sync-ing an older version of the react-native native libraries.

@lostintangent
Copy link
Member

Hey @mhagmajer! I'm super sorry to hear this! We haven't seen issues like this before, so I'd love to get to the bottom of it and figure out how we can either fix a bug in the product, make sure the docs are clearer, etc. Is this the error message that you saw?

Update is invalid - no files with extension .bundle, .js or .jsbundle were found in the update package.

Additionally, could you share an example of the react-native bundle and code-push release commands you ran? Just to help us double-check that we know the workflow you used.

After looking through our code and re-running through a bunch of scenarios, the only way we can imagine this issue is happening is under the following circumstances:

  1. Your app is calling sync on startup
  2. You released an update that was a directory, which didn't include a file with one of the following extensions: .js, .jsbundle or .bundle

This would have the effect of automatically downloading the update, and then crashing when the plugin can't find the JS bundle in the zip file. Once the user opens the app again, it would trigger sync again, and therefore, crash, causing the appearance of an infinite crash.

We're about to send out a PR that "blacklists" an update as having failed when we don't find the JS bundle, as opposed to throwing an exception. The plugin already has the concept of a blacklist, which will be ignored the next time the app calls sync. This would have the effect of making it such that step #2 wouldn't crash, but rather, would log the failure. Therefore, the next time your end-user starts the app, and you call sync, it would see the available update, but know that it failed, and would therefore, ignore it.

We believe this behavior fix makes sense to do regardless if it is what you're running into, but I would LOVE to verify if the two steps above reflect your scenario and are responsible for this issue.

Once again, I'm super sorry about this issue!

@mhagmajer
Copy link
Author

Guys, and especially @lostintangent, thank you for very informative responses! 👍

I wish I could present you with more details on the issue I encountered, however, I couldn't repro the problem after I moved the resources to within the app. I also checked if the assets updates work in a fresh project on RN 0.19.0 and RNCP 1.7.1-beta and they do. This is not a pressing matter to the development of our app and I can't investigate more what happened there right now. Next time we need to ship resources as an update, I'll keep a close look at this, and will reopen the issue with as much details as I can.

I'd like to take this opportunity to say how much I appreciate your work on this. Ability to immediately push updates to native client has speeden up our development a lot. Keep it up! :)

@lostintangent
Copy link
Member

That sounds great! Thanks so much for circling back with us. Ping us again if you hit any issues and we'll be happy to help investigate further :)

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

3 participants