Fatal Exception: java.lang.RuntimeException: Failure from system
Asked Answered
P

3

8

I am getting this exception on crashlytics report frequently don't know why?

 Fatal Exception: java.lang.RuntimeException: Failure from system
   at android.app.Instrumentation.execStartActivity(Instrumentation.java:1547)
   at android.app.Activity.startActivityForResult(Activity.java:4283)
   at android.app.Activity.startActivityForResult(Activity.java:4230)
   at android.support.v4.app.FragmentActivity.startActivityForResult(Unknown Source)
   at android.app.Activity.startActivity(Activity.java:4567)
   at android.app.Activity.startActivity(Activity.java:4535)
   at com.app.Register.MainActivity.onClick(Unknown Source)
   at android.view.View.performClick(View.java:5702)
   at android.widget.TextView.performClick(TextView.java:10887)
   at android.view.View$PerformClick.run(View.java:22533)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:158)
   at android.app.ActivityThread.main(ActivityThread.java:7224)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by android.os.TransactionTooLargeException: data parcel size 8177736 bytes
   at android.os.BinderProxy.transactNative(Binder.java)
   at android.os.BinderProxy.transact(Binder.java:503)
   at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3130)
   at android.app.Instrumentation.execStartActivity(Instrumentation.java:1540)
   at android.app.Activity.startActivityForResult(Activity.java:4283)
   at android.app.Activity.startActivityForResult(Activity.java:4230)
   at android.support.v4.app.FragmentActivity.startActivityForResult(Unknown Source)
   at android.app.Activity.startActivity(Activity.java:4567)
   at android.app.Activity.startActivity(Activity.java:4535)
   at ca.dailydelivery.driver.Register.AdditionalInfoActivity.onClick(Unknown Source)
   at android.view.View.performClick(View.java:5702)
   at android.widget.TextView.performClick(TextView.java:10887)
   at android.view.View$PerformClick.run(View.java:22533)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:158)
   at android.app.ActivityThread.main(ActivityThread.java:7224)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

What I am doing in this activity where the crash is generated is passing the Intent to capture an image from the Camera or Gallery.

Code :

 private void captureImage() {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
    // start the image capture Intent
    startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
}

private void openGallery() {
    Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
    photoPickerIntent.setType("image/*");
    startActivityForResult(photoPickerIntent, IMAGE_PICK_GALLERY);
}

Please suggest how to resolve this issue. Thanks

Primaveria answered 24/1, 2017 at 6:32 Comment(8)
what you want to do ?Silencer
@SharartiKAKA why issue is coming and how to figure out the problemPrimaveria
test with large images :)Erechtheum
What is OS version of phone? If its nougat, this may help - [#39099090Porphyria
what you want to achieve the code you provided is not enough to get what you are doing ////Silencer
@Wizard crash is coming in android 6.0 marshmallowPrimaveria
ur fileUri is null, try to add inside if block and see.Introgression
@SharartiKAKA what more piece of code you want let me knowPrimaveria
G
14

Reduce the image size which you have taken from camera then send to other activity.Because when we pass value it have some limitation for transaction.

The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.

More details TransactionTooLargeException

Gaskins answered 24/1, 2017 at 6:45 Comment(0)
P
4

During a remote procedure call, the arguments and the return value of the call are transferred as Parcel objects stored in the Binder transaction buffer. If the arguments or the return value are too large to fit in the transaction buffer, then the call will fail and TransactionTooLargeException will be thrown.

The key to avoiding TransactionTooLargeException is to keep all transactions relatively small. Try to minimize the amount of memory needed to create a Parcel for the arguments and the return value of the remote procedure call. Avoid transferring huge arrays of strings or large bitmaps. If possible, try to break up big requests into smaller pieces.

Reference

Porphyria answered 24/1, 2017 at 6:47 Comment(0)
M
1

Create a public class and pass the bitmap to it then in the second activity get the bitmap value from that public class.

import android.graphics.Bitmap;

public class BitmapTransfer {
    public static Bitmap bitmap = null;
}
Mufi answered 30/12, 2018 at 19:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.