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

Does not solve TransactionTooLargeException with icepick library #37

Closed
yogeshchoudhary147 opened this issue Apr 2, 2019 · 4 comments
Closed

Comments

@yogeshchoudhary147
Copy link

Hi @byencho ,

When used with icepick library, the TransactionTooLargeException still occurs.

Sample Code:

MyActivity.java:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bridge.restoreInstanceState(this, savedInstanceState);
}

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Bridge.saveInstanceState(this, outState);
}

@Override
public void onDestroy() {
    super.onDestroy();
    Bridge.clear(this);
}

MyApplication.java:

import icepick.Icepick;
import com.livefront.bridge.Bridge;
import com.livefront.bridge.SavedStateHandler;

@Override
public void onCreate() {
    super.onCreate();
    Bridge.initialize(getApplicationContext(), new SavedStateHandler() {
        @Override
        public void restoreInstanceState(@NonNull Object target, @Nullable Bundle state) {
            Icepick.restoreInstanceState(target, state);
        }
        @Override
        public void saveInstanceState(@NonNull Object target, @NonNull Bundle state) {
            Icepick.saveInstanceState(target, state);
        }
    });
}

It is a react native app with single activity.

dependencies {
    compile 'com.github.livefront:bridge:v1.1.3'
    compile 'frankiesardo:icepick:3.2.0'
    annotationProcessor 'frankiesardo:icepick-processor:3.2.0'
}


@byencho
Copy link

byencho commented Apr 2, 2019

@yogeshchoudhary147 You'd need to show me how you are saving your data. If you're not using @State annotations (which is how Icepick works), you're not going to avoid the problem.

@yogeshchoudhary147
Copy link
Author

Thanks for your quick response @byencho.

I am not actually not doing anything else in MainActivity.java. I am not using @State annotations. I recently upgraded my app's targetSdkVersion and this crash started happening. That's when I came across your library. Please guide me what needs to be done to get rid of this crash.

@byencho
Copy link

byencho commented Apr 3, 2019

@yogeshchoudhary147 If you are not using @State, then using Bridge + Icepick does nothing. Please refer to the Icepick docs or check out the Bridge sample app for appropriate usage.

If you are not manually saving any other kind of state in your Activity, then the problem is probably too much state being saved in the Views by React Native. Please see the (unresolved) issue discussion here : facebook/react-native#19458 .

@yogeshchoudhary147 yogeshchoudhary147 changed the title Does not solve TransactionTooLargeException with icepick library, when enabled globally Does not solve TransactionTooLargeException with icepick library Apr 3, 2019
@byencho
Copy link

byencho commented Apr 4, 2019

@yogeshchoudhary147 I'm going to close this issue for now, since it's really just a problem with state-saving inside React-Native and not with Bridge / Icepick. Bridge is only intended to help with state you manually save yourself inside an Activity / Fragment / etc., not in state that is saved generically by the OS or some third-party library.

@byencho byencho closed this as completed Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants