We are attempting to implement CodePush from Microsoft App Center. We have managed to get to the point where the application downloads the package, and unpacks it. However, it always ends with the response
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.
We've made the changes to the MainApplication.java
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@NonNull
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
and
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// Add additional packages you require here
// No need to add RnnPackage and MainReactPackage
new ActionSheetPackage(),
new PickerPackage(),
new ReactNativeOneSignalPackage(),
new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),
new CalendarEventsPackage()
);
}
In the app code, we call
Navigation.registerComponent(ScreenNames.Landing.id, () => CodePush(codePushOptions)(LandingScreen), store, Provider);
The final logs from code-push debug android
[11:31:37] Awaiting user action.
[11:31:42] Downloading package.
[11:31:43] An unknown error occurred.
[11:31:43] 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.
It appears the react-native linker is putting some things in the wrong class
public class MainApplication extends NavigationApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this)
{
@NonNull
@Override
public String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
The override should be on MainApplication, not the ReactNativeHost
public class MainApplication extends NavigationApplication {
@NonNull
@Override
public String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this)
{ /*... */ }