microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

A JS bundle file named "null" #2389

Closed NoelMiranda1 closed 1 year ago

NoelMiranda1 commented 1 year ago

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

  1. Release bercion to dev environment with minimal update
  2. start the application and wait for the available update dialog 3.Press Install option and cannot install the version returning this error: Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.

Expected Behavior

What you expected to happen? That the update is installed correctly

Actual Behavior

What actually happens?

  STACK TRACE AND/OR SCREENSHOTS

Captura de pantalla 2022-12-09 a la(s) 10 52 23

Captura de pantalla 2022-12-09 a la(s) 10 52 43 Captura de pantalla 2022-12-09 a la(s) 10 52 51

Environment

Dooqp commented 1 year ago

-----FIX-----

@NoelMiranda1

I've faced with the same issue and fixed it by overriding getJSBundleFile method inside MainApplicationReactNativeHost class. The problem was I was using new architecture for android but documentation only talks about overriding getJSBundleFile method inside ReactNativeHost (which is used if newarchitecture is disabled)

...
// 1. Import the plugin class.
import com.microsoft.codepush.react.CodePush;

public class MainApplication extends Application implements ReactApplication {

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
        ...

        // 2. Override the getJSBundleFile method in order to let
        // the CodePush runtime determine where to get the JS
        // bundle location from on each app start
        @Override
        protected String getJSBundleFile() {
            return CodePush.getJSBundleFile();
        }
    };
}

but if the new architecture is enabled react-native uses MainApplicationReactNativeHost which is inside "newarchitecture" folder of your project. So just override this method there as well and it will work. (It did work on my case at least).

I think it should have been pointed out on Android Setup docs as well

NoelMiranda1 commented 1 year ago

-----FIX-----

@NoelMiranda1

I've faced with the same issue and fixed it by overriding getJSBundleFile method inside MainApplicationReactNativeHost class. The problem was I was using new architecture for android but documentation only talks about overriding getJSBundleFile method inside ReactNativeHost (which is used if newarchitecture is disabled)

...
// 1. Import the plugin class.
import com.microsoft.codepush.react.CodePush;

public class MainApplication extends Application implements ReactApplication {

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
        ...

        // 2. Override the getJSBundleFile method in order to let
        // the CodePush runtime determine where to get the JS
        // bundle location from on each app start
        @Override
        protected String getJSBundleFile() {
            return CodePush.getJSBundleFile();
        }
    };
}

but if the new architecture is enabled react-native uses MainApplicationReactNativeHost which is inside "newarchitecture" folder of your project. So just override this method there as well and it will work. (It did work on my case at least).

I think it should have been pointed out on Android Setup docs as well

This does not accompany my problem since I do not have the new RN architecture, in the same way I have tried it without success

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 1 year ago

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.

microsoft-github-policy-service[bot] commented 1 year ago

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.