React-native-code-push: could not open file index.android.bundle after restart app

Created on 11 Jun 2019  路  11Comments  路  Source: microsoft/react-native-code-push

Hi, my app is in debug mode, and I add this to app/build.gradle

project.ext.react = [
    bundleInDebug: true
]

Steps to Reproduce

1.app check update and the update is installed
ReactNativeJS: [CodePush] Checking for update.
ReactNativeJS: [CodePush] Awaiting user action.
ReactNativeJS: [CodePush] Downloading package.
ReactNative: [CodePush] Applying full update.
ReactNativeJS: [CodePush] Installing update.
ReactNativeJS: [CodePush] Update is installed and will be run on the next app restart.

  1. restart app
    ReactNative: [CodePush] Loading JS bundle from "/data/user/0/pkgName/files/CodePush/33601dfc1a2ec23e07ab178f548e3f1aa2a50f07f1fcf61f6829f278951417f7/CodePush/index.android.bundle"
    ReactNative: [CodePush] Update did not finish loading the last time, rolling back to a previous version.
    ReactNative: [CodePush] Loading JS bundle from "assets://index.android.bundle"
    3.open the react-native activity
    com.facebook.jni.CppException: facebook::react::Recoverable: Could not open file/data/user/0/pkgName/files/CodePush/33601dfc1a2ec23e07ab178f548e3f1aa2a50f07f1fcf61f6829f278951417f7/CodePush/index.android.bundle: No such file or directory

Expected Behavior

update can apply to my app

Actual Behavior

update not work

Reproducible Demo

Environment

  • react-native-code-push version: 5.6.0
  • react-native version: 0.59.8
  • iOS/Android/Windows version: Android Q
  • Does this reproduce on a debug build or release build? debug build
  • Does this reproduce on a simulator, or only on a physical device? physical device Google pixel 2

project integrates react-native and react-native-navigation v2 into existing native app

android bug waiting-for-clarification

Most helpful comment

How it works brother? I face with same issue. What did you change, would you share it please? @dreamhb

All 11 comments

My GlobalApplication.java:

GlobalApplication extends NavigationApplication {

//---------- other code above ---------------
@Override
    public boolean isDebug() {
        return BuildConfig.DEBUG;
    }

    @Nullable
    @Override
    public List<ReactPackage> createAdditionalReactPackages() {
        return Arrays.asList(
                new MainReactPackage(),
                new CodePush(CODE_PUSH_DEPLOYMENT_KEY, getApplicationContext(), isDebug()),
                new ReactPackage() {

                    @Nonnull
                    @Override
                    public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) {
                        return Arrays.asList(new ReactModule(reactContext));
                    }

                    @Nonnull
                    @Override
                    public List<ViewManager> createViewManagers(@Nonnull ReactApplicationContext reactContext) {
                        return Collections.EMPTY_LIST;
                    }
                });
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }


    @Override
    protected ReactGateway createReactGateway() {
        ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
            @Override
            protected String getJSMainModuleName() {
                return "index";
            }

            @javax.annotation.Nullable
            @Override
            protected String getJSBundleFile() {
                return CodePush.getJSBundleFile();
            }
        };
        return new ReactGateway(this, isDebug(), host);
    }
}

Hi @dreamhb
Thanks for reporting!

I found this issue in your logs: [CodePush] Update did not finish loading the last time, rolling back to a previous version.. It can be the reason for your issue with opening index.android.bundle.

I'm not sure what can be a reason for this main issue. Could you please try to make a new release. If this issue will be here could you please provide some dummy project with reproducing issue and reprosteps? I would like to debug it.

And could you please try to test CodePush app with release mode? It should resolve this issue.

Hi,
Thanks for response!
I've tried release build and bundled a Production bundle, but it's still the same error.

[CodePush] Update did not finish loading the last time, rolling back to a previous version.
[CodePush] Loading JS bundle from "assets://index.android.bundle"

And I use this command to bundle a bundle:

appcenter codepush release-react -a ***/*** --debug -d Production

I find there is only one file codepush.json under

/data/user/0/pkgName/files/CodePush/

So where is the index.android.bundle ?

index.android.bundle is missed because your app has some issue with downloading an update as your logs have [CodePush] Update did not finish loading the last time, rolling back to a previous version.. I'm not sure what is the real reason for the issue.
Could you please provide some dummy project with reproducing issue and reprosteps? I would like to debug it.

Thanks, now it works!

Thanks, now it works!

How it works brother? I face with same issue. What did you change, would you share it please? @dreamhb

How it works brother? I face with same issue. What did you change, would you share it please? @dreamhb

How it works brother? I face with same issue. What did you change, would you share it please? @dreamhb

+1

How it works brother? I face with same issue. What did you change, would you share it please? @dreamhb

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fuhrmann picture Fuhrmann  路  3Comments

quanzaiyu picture quanzaiyu  路  3Comments

sergey-akhalkov picture sergey-akhalkov  路  4Comments

ACCTFORGH picture ACCTFORGH  路  3Comments

Phredward picture Phredward  路  3Comments