microsoft / code-push

A cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users’ devices.
https://microsoft.github.io/code-push/
Other
4.37k stars 498 forks source link

[Android] Images not loaded after releasing a new version #198

Closed kkgelu closed 8 years ago

kkgelu commented 8 years ago

On android:

  1. I upload an APK to google play store, an image(png) is loaded in a specific place of the app
  2. nothing is changed to that very same image or code related to it, I code-push/release a new version of the app for some other changes
  3. app downloads the version, restarts properly; Then that image is not loaded, blank!

My code-push command tool version is 1.9.1-beta; My react-native app has the version of "react-native-code-push": "^1.8.0-beta" in package.json.

An example of the image:

Path in my React native app: myapp/image/map/marker4_jp.png (140 × 180)

Code to show the image:

<Image source = {require('../image/map/marker4_jp.png')}  />

I can see in the generated bundle (for upload), it's located in:

myapp/release/drawable-mdpi/image_map_marker4_jp.png

Please notice that the name _image_map_marker4jp.png is different than the original file name, but I guess that's by design? Even more strange, I can see in the same myapp/release/drawable-mdpi/ folder, most of the other images do load in the newer version after restart. So it doesnot happen to every image.

I' ll see if I can provide more information, it's just hard for me to debug...

geof90 commented 8 years ago

@kkgelu, is it always that one image that is problematic? Does this happen consistently, or do images disappear at random?

Do you think this issue could be related? https://github.com/facebook/react-native/issues/5568

kkgelu commented 8 years ago

Hmm... I just realised I should have filled this one to https://github.com/Microsoft/react-native-code-push

Yes, it happened twice:

  1. I uploaded a new APK to Google Play, images were there
  2. Code-pushed a new version, certain images were gone
  3. I had to upload another APK to get those images back
  4. I decided to give it try again, and Code-pushed a minor change(let's say a string change)
  5. The images are gone again

It's totally possible something else is wrong. Those images are markers on the (buggy) https://github.com/lelandrichardson/react-native-maps component.

I am willing to wait a little to try later with latest code-push command tool and react native plugin. For now I stop code pushing on Android.

lostintangent commented 8 years ago

@kkgelu Just to confirm: the only images that disappear are markers on the map component, and they disappear every time you release a CodePush update (as opposed to only randomly)? If so, that sounds like an incompatibility between the maps component and CodePush. We maintain a list of supported components precisely because we recognize that not every component which allows you to reference image assets will automatically work with CodePush. We can test out the maps component today and see what the issue might be and possibly we can send a PR to it to fix it.

In the future, I would recommend testing the CodePush update experience locally using a non-production deployment key. That way, you can verify that it supports all of your requirements instead of needing to be surprised in production. We're working hard to address all of these interop issues, but we haven't been able to resolve them all yet.

kkgelu commented 8 years ago

@lostintangent thank you for suggestions!

Yes. I have 3 of 4 markers consistently disappear every time I release a new CodePush update. I'll plan some time next week to see if I can repro without React Native maps.

dtivel commented 8 years ago

@kkgelu, I investigated this and reproduced the behavior with react-native@0.22.2, react-native-maps@0.3.1 and react-native-code-push@ 1.10.0-beta.

The issue is that assets loaded from a CodePush update are referenced with a file:// URI, but react-native-maps doesn't support file:// URI's. A simple fix this would be add || uri.startsWith("file://") as a condition in this line.

dtivel commented 8 years ago

@kkgelu, the change has been merged into lelandrichardson/react-native-maps.