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 crash with InstallMode.IMMEDIATE - IllegalViewOperationException: Trying to remove a view index above child count #986

Closed
AndrewJack opened this issue Aug 31, 2017 · 14 comments

Comments

@AndrewJack
Copy link
Contributor

AndrewJack commented Aug 31, 2017

I wondered if you'd seen something similar in facebook/react-native#14533? @sergey-akhalkov ?

Steps to Reproduce

  1. Install old app with RN 0.44 & code push v3.0.1.
  2. Download and run a new bundle update.
  3. Update app binary with RN 0.47 & code push v5.0.0
  4. Install code push update with InstallMode.IMMEDIATE

Only occurs when the app is upgrading, but I can't see if it is doing anything different so far.

Expected Behaviour

App Restarts

Actual Behavior

What actually happens?
App will crash with following stacktrace.

FATAL EXCEPTION: main
Process: com.example, PID: 14747
com.facebook.react.uimanager.IllegalViewOperationException: Trying to remove a view index above child count 0 view tag: 1
 detail: View tag:-1
  children(0): [
 ],
  indicesToRemove(1): [
0,
 ],
  tagsToDelete(1): [
4,
 ]

    at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:346)
    at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:177)
    at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:776)
    at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:855)
    at com.facebook.react.uimanager.UIViewOperationQueue.access$1600(UIViewOperationQueue.java:46)
    at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:813)
    at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:21)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Environment

  • react-native-code-push version: v3.0.1 / v5.0.0
  • react-native version: 0.44/0.47
  • iOS/Android/Windows version: Android - Any
  • Does this reproduce on a debug build or release build? release
  • Does this reproduce on a simulator, or only on a physical device? physical
@sergey-akhalkov
Copy link
Contributor

Hi @AndrewJack, thanks for reaching us. No, I've not seen similar issues.

  1. Is there a chance if you have the same issue as here App layout breaks after hot-push + upgrade from RN 0.42 to 0.43rc on iOS #775 (comment) ?
  2. Have you incremented your app version after upgrade?
  3. Is there a chance that you've released a CodePush update a long time ago that may target to your current app binary version?

@AndrewJack
Copy link
Contributor Author

Thanks, I don't think there is any chance of mixing RN versions, they are all targeted at the correct binary versions.

I will try to reproduce in a simpler sample app.

@sergey-akhalkov
Copy link
Contributor

@AndrewJack, got it, thank you, please let us know if you have any updates or have any questions.

@sergey-akhalkov
Copy link
Contributor

Hi @AndrewJack, just a friendly ping - do you have any updates on this?

@AndrewJack
Copy link
Contributor Author

Hey sorry, I'm a bit busy right now. I've worked around my problem for now by removing the immediate update.

Feel free to close this issue. I'll reopen when I have more information.

@sergey-akhalkov
Copy link
Contributor

Got it, thanks for the update!

@sood03
Copy link

sood03 commented Sep 6, 2017

@AndrewJack , Even I am facing the same error with RN 0.45.1 and RNCP 3.0.0-beta.

My CodePush configuration is

CodePush.sync(
  { updateDialog: true, installMode: CodePush.InstallMode.IMMEDIATE },
    status => {
        switch (status) {
          case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
            this.setState({ showDownloadingModal: true });
            this._modal.open();
            break;
          case CodePush.SyncStatus.INSTALLING_UPDATE:
            this.setState({ showInstalling: true });
            break;
          case CodePush.SyncStatus.UPDATE_INSTALLED:
            this._modal.close();
            this.setState({ showDownloadingModal: false });
            break;
          default:
            break;
        }
      },
      ({ receivedBytes, totalBytes }) => {
        this.setState({ downloadProgress: receivedBytes / totalBytes * 100 });
      }
    );

What is the install mode you set which got your code push working?

@sood03
Copy link

sood03 commented Sep 23, 2017

Removing this piece of code from UPDATE_INSTALLED case made my code-push working

this._modal.close();
this.setState({ showDownloadingModal: false });

So my UPDATE_INSTALLED case is just empty.

@AndrewJack
Copy link
Contributor Author

FYI - removing any state changes after a UPDATE_INSTALLED status change fixed this for me.

@vinaysmart
Copy link

Yup,I too face same issue it is not happening on debug mode it is happening on release apk only. After removing setState code under UPDATE_INSTALLED it is working fine. Guess it is accessing state which is not there

@Li357
Copy link

Li357 commented Jul 24, 2018

@sood03 How did you end up closing your modal then? I'm depending on state to know when codepush is finished installing the update. Only then do I actually render my App component. How would I know when codepush is finished?

@tmaly1980
Copy link
Contributor

@Li357 Did you ever figure this out? I'm wondering the same thing.... How to show the app content once the update is complete. I'm making a wild guess that the second time the app is loaded that it will trigger UP_TO_DATE, which can then close the loading screen?

@tmaly1980
Copy link
Contributor

I can actually confirm that it works. Seems my UP_TO_DATE case that closes my loading screen is good enough.

@sridhard
Copy link

sridhard commented Mar 5, 2019

@tmaly1980 @vinaysmart @sergey-akhalkov In my app I have removed all setState in codepush notifications. We are not doing anything in codepush notifications except logging. Still we face this issue.

About 2-3% of the users are facing this issue.

In our app we dont do anything in codepush notifications, so the app continues rendering the screens. Then the user will start using the app when the codepush download/install is in progress. If we dont have any logic in notifications then how to avoid user to stop using the app? since the user is using the app there will be some setState in the app, which may be causing this issue.

Also I have noticed then after the codepush gives UPDATE_INSTALLED notification, app is not restarting. I have tested by killing and opening the app. Codepush is downloading/installing the update, the changes are reflected in app but there is no restart(I have added logs in the constructor to verify this)

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

7 participants