React-native-code-push: [Android] App restart loop when using InstallMode.ON_NEXT_RESUME

Created on 17 May 2017  路  8Comments  路  Source: microsoft/react-native-code-push

Description

When InstallMode.ON_NEXT_RESUME is used on android the app will go into a restart loop and crash the app.

Reproduction

  1. Initialise with the following code push options
    { checkFrequency: CheckFrequency.ON_APP_RESUME, installMode: InstallMode.ON_NEXT_RESUME }
  2. Run the app - wait for it to download the update
  3. Press the home button
  4. Resume the app from the multi task view
    Observe: App will go black and into a loop of onResume -> loadBundle

I think the cause is around here - https://github.com/Microsoft/react-native-code-push/blob/master/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java#L470

Additional Information

  • react-native-code-push version: 2.0.3-beta
  • react-native version: 0.44
  • iOS/Android/Windows version: Android 7.1
  • Does this reproduce on a debug build or release build? Release build
  • Does this reproduce on a simulator, or only on a physical device? Reproduced on a device
android bug fix-in-master

All 8 comments

Trying to reproduce on the Example

Hi @AndrewJack, thanks for reaching us.

Trying to reproduce on the Example

Got it, this would be very helpful for investigation, please let me know if any updates.

@sergey-akhalkov I've figured it out.

  • Enable proguard
  • perform the same steps as above

Then this happens:

Do we still need this legacy support in v2 of code push? Now v2 only support RN v0.43?

I've fixed my code by adding -keep class com.facebook.react.** { *; } for now

I previously had:

-keep class com.facebook.react.cxxbridge.** { *; }
-keep class com.facebook.react.bridge.** { *; }

which worked fine except for code push

Things to fix:

  1. Remove support for old react native versions that may not work anyway (and all the reflection)? Now that v2 only supports RN 0.43 and later.
  2. Fix loadBundleLegacy infinite loop if 1 isn't fixed.
  3. add proguard rules to setup

@AndrewJack, thank you for such great investigation! I think we can remove support for old react native versions due to breaking changes that have been released in v2.0.1-beta. We'll fix the issue asap, but if you have a time and ability you could help us to deliver this fix much faster (due to you already have configured environment) by publishing pull request - we'll be very grateful.

Please let us know if it works for you (if not, we'll start investigating and fixing it asap) or if you have any questions.

https://github.com/Microsoft/react-native-code-push/pull/845 - let me know if you need anything changed

I'm surprised code push doesn't have an supported react native api to setJSBundle yet.

@AndrewJack, thank you for the contribution! I'll review it and notify you if needed.

I'm surprised code push doesn't have an supported react native api to setJSBundle yet.

I suppose that React Native module for CodePush have been implemented a long time ago and have supported big amount of react-native versions until v2.0.1-beta. As of now I think code-push could support react native api to setJSBundle. We'll investigate and implement it, thank you for your advice. Please also let me know if you have any thoughts/advises that could help us to implement this better way.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sergey-akhalkov picture sergey-akhalkov  路  4Comments

diegocouto picture diegocouto  路  4Comments

Phredward picture Phredward  路  3Comments

Fuhrmann picture Fuhrmann  路  3Comments

osdnk picture osdnk  路  3Comments