React-native-code-push: RN 0.34 and 0.35 Support

Created on 28 Sep 2016  路  10Comments  路  Source: microsoft/react-native-code-push

  • react-native-code-push version: 1.14.6-beta
  • react-native version: 0.34.0

We have just verified RN 0.33.0 is supported in the latest version of CodePush. RN 0.34.0 is not supported yet, so this issue tracks verifying RN 0.34 support, including any required fixes. If you have tested this and run into specific issues, please post them here!

Most helpful comment

22d2a146d2901857714eafa2552d68264b87137e has been lightly tested on both iOS and Android against RN 0.34.1 and should be stable. Alternatively, I am trying to get two more small additions into the next release, and that should be published and well-tested within the next two days.

All 10 comments

Hi, please see https://github.com/Microsoft/react-native-code-push/issues/540 might be related to 0.34 ?

@stewart42 - I am fairly sure that your issue is related to a breaking change in RN 0.34, so I'm moving your issue here:

  • react-native-code-push version: 1.14.6-beta
  • react-native version: 0.34
  • iOS/Android version: Android 7.0
  • Does this reproduce on a simulator, or only on a physical device? physical device (Nexus 5x)
  • Repro steps and/or stack trace:
const codePushOptions = {
    checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
    installMode: codePush.InstallMode.ON_NEXT_RESUME,
    mandatoryInstallMode: codePush.InstallMode.IMMEDIATE,
};
  • upload a new bundle to code-push servers
  • pause the activity
  • resume the activity
  • codepush downloads new bundle
  • pause the activity
  • resume the activity and then below happens

    1. The exception java.lang.NoSuchMethodException: createFileLoader [class android.content.Context, class java.lang.String] occurs at L116

    2. then an exception java.lang.NoSuchFieldException: No field mJSBundleFile in class Lcom/facebook/react/XReactInstanceManagerImpl; (declaration of 'com.facebook.react.XReactInstanceManagerImpl' appears in /data/app/com.xxxxxxxx.android.debug-1/base.apk) is raised at L122

    3. the outer catch then triggers loadBundleLegacy() which attempts to recreate the activity

    4. once the activity is recreated the onHostResume event fires L434 and loadBundle is called looping back to the first excpetion above

We are imbedding this in an existing app that does have multiDexEnabled set to true, not sure if this is relevant?

Any ideas what I am doing wrong?

We will address this early next week, but if a fix is needed immediately, you could downgrade to RN 0.33.0. Thanks to @geof90 for identifying the cause:

This is (yet another) breaking API change to JsBundleLoader.createFileLoader in RN 0.33 (it no longer requires a Context to be passed to it). See the related commit: https://github.com/facebook/react-native/commit/0c2fdf4b6af3c4193d351ed615b9fc12c941173a#diff-e110fa648a5e434c9533e8e35b5b1f6dR50

We need to change this line https://github.com/Microsoft/react-native-code-push/blob/master/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java#L116 in our code.

I can confirm that changing L116 and L117 to:

Method createFileLoaderMethod = jsBundleLoaderClass.getDeclaredMethod("createFileLoader", String.class);
Object latestJSBundleLoader = createFileLoaderMethod.invoke(jsBundleLoaderClass, latestJSBundleFile);

did resolve the issue for RN 0.34. I am not sure how to best structure the code to handle the various versions of react-native. One suggestion could be to tie the versions react-native-code-push to react-native, in the same way that react-native does with react?

@stewart42 it work for me :) 馃憤

@stewart42 - sorry I didn't reply! We generally try to support older versions of RN for as long as possible, as not everybody updates to the latest version, and we still want them to be able to receive the latest CodePush features and fixes. I've put our PR #557 which maintains backward compatibility - thanks so much for helping to validate the fix!

Thanks for getting things working with 0.34! Do you know when a tag will be published with the fix yet, or are there snapshot builds of master that can be used in the meantime?

22d2a146d2901857714eafa2552d68264b87137e has been lightly tested on both iOS and Android against RN 0.34.1 and should be stable. Alternatively, I am trying to get two more small additions into the next release, and that should be published and well-tested within the next two days.

v1.15.0-beta has been published, and has been tested up to React Native 0.35.0! Release notes can be found at: https://github.com/Microsoft/react-native-code-push/releases/tag/v1.15.0-beta. Thanks so much for the patience, and we look forward to your feedback!

@silhouettes thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ninjz picture ninjz  路  4Comments

Adr1ann picture Adr1ann  路  3Comments

EdmundMai picture EdmundMai  路  4Comments

Phredward picture Phredward  路  3Comments

cgerikj picture cgerikj  路  3Comments