2

Been pulling my hair out trying to figure out why my app keeps crashing, I've nailed it down to having this in my main activities layout XML.

<com.facebook.login.widget.ProfilePictureView
                        android:id="@+id/pp"
                        android:layout_gravity="center"
                        android:layout_height="match_parent"
                        android:layout_width="match_parent">
                    </com.facebook.login.widget.ProfilePictureView>

Whenever I have this in my main activity layout, and I try to create any new intents (new activities, facebook sign in or requesting permissions) My app crashed with a FAILED BINDER TRANSACTION and TransactionTooLargeException.

This continues to happen when I remove the profile picture code in the activity class. It seems to be the view appearing that's casing this but I cannot think why.

This occurs not on my main testign device, but on all emulators and other devices Ive tried.

stacktrace

03-13 15:29:21.347 28962-28962/uk.co.claytapp.taggerbath E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1443592)
03-13 15:29:21.348 28962-28962/uk.co.claytapp.taggerbath D/AndroidRuntime: Shutting down VM
03-13 15:29:21.348 28962-28962/uk.co.claytapp.taggerbath E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: uk.co.claytapp.taggerbath, PID: 28962
                                                                       java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1443592 bytes
                                                                           at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3752)
                                                                           at android.os.Handler.handleCallback(Handler.java:751)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                           at android.os.Looper.loop(Looper.java:154)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
                                                                        Caused by: android.os.TransactionTooLargeException: data parcel size 1443592 bytes
                                                                           at android.os.BinderProxy.transactNative(Native Method)
                                                                           at android.os.BinderProxy.transact(Binder.java:615)
                                                                           at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3606)
                                                                           at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3744)
                                                                           at android.os.Handler.handleCallback(Handler.java:751) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                           at android.os.Looper.loop(Looper.java:154) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:6077) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
Sam
  • 454
  • 4
  • 18
  • Could you post your stacktrace? – Ruben Aalders Mar 13 '17 at 15:38
  • @RubenAalders yes done – Sam Mar 13 '17 at 15:40
  • Did you already encounter this question? http://stackoverflow.com/questions/11451393/what-to-do-on-transactiontoolargeexception – Ruben Aalders Mar 13 '17 at 15:42
  • I have, yet I am not sending any info to or from a service I am aware of. I am not even requesting any profile pictures in the view. The view is not initialized in code anywhere. But whenever I have the view in the layout, and try any new intents or permission requests, I get this error. I do not know what is filling the parcel or where it is. – Sam Mar 13 '17 at 15:46

1 Answers1

2

This most likely happens in the onSaveInstanceState(Bundle outState) method of the activity you are navigating away from.

To fix it, add android:saveEnabled="false" to your ProfilePictureView like so:

    <com.facebook.login.widget.ProfilePictureView
        android:id="@+id/profilePicture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:saveEnabled="false"
        facebook:com_facebook_preset_size="normal" />

This will prevent Android to call ProfilePictureView's own onSaveInstanceState method (the view hierarchy is stored by the Activity anyway so it won't hurt).

Damnum
  • 1,839
  • 16
  • 35