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

[Android] App restart loop when using InstallMode.ON_NEXT_RESUME #841

Closed
AndrewJack opened this issue May 17, 2017 · 8 comments
Closed

[Android] App restart loop when using InstallMode.ON_NEXT_RESUME #841

AndrewJack opened this issue May 17, 2017 · 8 comments

Comments

@AndrewJack
Copy link
Contributor

AndrewJack commented May 17, 2017

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
@AndrewJack
Copy link
Contributor Author

Trying to reproduce on the Example

@sergey-akhalkov
Copy link
Contributor

sergey-akhalkov commented May 17, 2017

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.

@AndrewJack
Copy link
Contributor Author

AndrewJack commented May 18, 2017

@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?

@AndrewJack
Copy link
Contributor Author

AndrewJack commented May 18, 2017

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

@AndrewJack
Copy link
Contributor Author

AndrewJack commented May 18, 2017

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

@sergey-akhalkov
Copy link
Contributor

sergey-akhalkov commented May 18, 2017

@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.

@AndrewJack
Copy link
Contributor Author

AndrewJack commented May 18, 2017

#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.

@sergey-akhalkov
Copy link
Contributor

sergey-akhalkov commented May 19, 2017

@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.

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

No branches or pull requests

2 participants