ImagePicker icon indicating copy to clipboard operation
ImagePicker copied to clipboard

TransactionTooLargeException

Open klaszlo8207 opened this issue 4 years ago • 3 comments

I am getting this, when selected any image

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 43091464 bytes at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:161) at android.os.Handler.handleCallback(Handler.java:900) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8393) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) Caused by: android.os.TransactionTooLargeException: data parcel size 43091464 bytes

android 10 Huawei Mate 20 pro

private fun getBase64Image() {
    ImagePicker.with(requireActivity())
        .compress(70)                        //70 KB
        .maxResultSize(512, 512)       //512*512 px
        .cropSquare()
        //.galleryOnly()
        .cameraOnly()
        .createIntent { intent ->
            startImageResult.launch(intent)
        }
}

implementation 'com.github.dhaval2404:imagepicker:2.1' implementation("com.github.florent37:inline-activity-result-kotlin:1.0.4") implementation "androidx.activity:activity-ktx:1.2.3" implementation "androidx.fragment:fragment-ktx:1.3.5"

klaszlo8207 avatar Jul 19 '21 13:07 klaszlo8207

In the profiler my app is about 120-160 MB, when selected the ImagePicker and the camera photo take it increases to 280-300 MB, then crash! What is the solution?

klaszlo8207 avatar Jul 19 '21 14:07 klaszlo8207

@klaszlo8207 Can you please try changing the resolution of the camera picture qualities. That might fix your issue temporary.

hitesh-dhamshaniya avatar Jul 22 '21 13:07 hitesh-dhamshaniya

@klaszlo8207 Can you please try changing the resolution of the camera picture qualities. That might fix your issue temporary.

Sorry I can't. In the profiler increased a lot of memory like I said.

I tried this lib too:

https://github.com/esafirm/android-image-picker

but the same probleme occured... So I ended up with this super library:

https://github.com/shaon2016/ProPicker

This is working like a charm!

This lib also better then the other two, because you can call it from anywhere, not just from fragments, and activities :)

klaszlo8207 avatar Jul 22 '21 14:07 klaszlo8207