PixEditor icon indicating copy to clipboard operation
PixEditor copied to clipboard

Always Crash

Open leokwsw opened this issue 6 years ago • 5 comments
trafficstars

I cloned the PixEditor repo or implement in my application always crash. How can I successfully using it?

leokwsw avatar Oct 25 '19 00:10 leokwsw

I also cloned the repository and tried to run it and when i added the missing recyclerview and adapter in sample MainActivityjava the app always crash I don't even know why it tries to seralize any global field this is logcat exception

2019-10-26 09:24:25.343 14817-14817/com.islamassem.myapplication E/data init: -> /storage/emulated/0/Pictures/Screenshots/Screenshot_20191024-235435.jpg 2019-10-26 09:24:25.432 14817-14817/com.islamassem.myapplication E/AndroidRuntime: FATAL EXCEPTION: main Process: com.islamassem.myapplication, PID: 14817 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=102, result=-1, data=Intent { (has extras) }} to activity {com.islamassem.myapplication/com.islamassem.myapplication.pixeditorsample.MainActivityJava}: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.fxn.pixeditor.EditOptions) at android.app.ActivityThread.deliverResults(ActivityThread.java:5041) at android.app.ActivityThread.handleSendResult(ActivityThread.java:5084) at android.app.ActivityThread.-wrap20(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7529) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) Caused by: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.fxn.pixeditor.EditOptions) at android.os.Parcel.writeSerializable(Parcel.java:1770) at android.os.Parcel.writeValue(Parcel.java:1718) at android.os.Parcel.writeArrayMapInternal(Parcel.java:785) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1510) at android.os.Bundle.writeToParcel(Bundle.java:1181) at android.os.Parcel.writeBundle(Parcel.java:825) at android.content.Intent.writeToParcel(Intent.java:9676) at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:4369) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1631) at android.app.Activity.startActivityForResult(Activity.java:4762) at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676) at android.app.Activity.startActivityForResult(Activity.java:4702) at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663) at com.fxn.pixeditor.PixEditorJave$3.onWorkFinish(PixEditorJave.java:180) at com.fxn.pixeditor.imageeditengine.utils.PermUtil.checkForCamaraWritePermissions(PermUtil.kt:51) at com.fxn.pixeditor.PixEditorJave.start(PixEditorJave.java:175) at com.islamassem.myapplication.pixeditorsample.MainActivityJava.onActivityResult(MainActivityJava.java:72) at android.app.Activity.dispatchActivityResult(Activity.java:7701) at android.app.ActivityThread.deliverResults(ActivityThread.java:5037) at android.app.ActivityThread.handleSendResult(ActivityThread.java:5084)  at android.app.ActivityThread.-wrap20(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)  at android.os.Handler.dispatchMessage(Handler.java:108)  at android.os.Looper.loop(Looper.java:166)  at android.app.ActivityThread.main(ActivityThread.java:7529)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)  Caused by: java.io.NotSerializableException: androidx.recyclerview.widget.RecyclerView at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1233) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1597) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1558) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1481) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1227) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1597) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1558) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1481) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1227) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at android.os.Parcel.writeSerializable(Parcel.java:1765) at android.os.Parcel.writeValue(Parcel.java:1718)  at android.os.Parcel.writeArrayMapInternal(Parcel.java:785)  at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1510)  at android.os.Bundle.writeToParcel(Bundle.java:1181)  at android.os.Parcel.writeBundle(Parcel.java:825)  at android.content.Intent.writeToParcel(Intent.java:9676)  at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:4369)  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1631)  at android.app.Activity.startActivityForResult(Activity.java:4762)  at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)  at android.app.Activity.startActivityForResult(Activity.java:4702)  at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)  at com.fxn.pixeditor.PixEditorJave$3.onWorkFinish(PixEditorJave.java:180)  at com.fxn.pixeditor.imageeditengine.utils.PermUtil.checkForCamaraWritePermissions(PermUtil.kt:51)  at com.fxn.pixeditor.PixEditorJave.start(PixEditorJave.java:175)  at com.islamassem.myapplication.pixeditorsample.MainActivityJava.onActivityResult(MainActivityJava.java:72)  at android.app.Activity.dispatchActivityResult(Activity.java:7701)  at android.app.ActivityThread.deliverResults(ActivityThread.java:5037)  at android.app.ActivityThread.handleSendResult(ActivityThread.java:5084)  at android.app.ActivityThread.-wrap20(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)  at android.os.Handler.dispatchMessage(Handler.java:108)  at android.os.Looper.loop(Looper.java:166)  at android.app.ActivityThread.main(ActivityThread.java:7529)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 

IslamAssem avatar Oct 26 '19 07:10 IslamAssem

Logcat said crash on Parcelable encountered IOException writing serializable object (name = com.fxn.pixeditor.EditOptions)

leokwsw avatar Nov 01 '19 04:11 leokwsw

Anybody found a solution to this??

Parag2385 avatar Jun 16 '20 07:06 Parag2385

I found the solution, instead of implementing AddMoreImagesListener at activity or fragment level, just create a variable for it like this:

var mAddMoreListener = object: AddMoreImagesListener{
    override fun addMore(context: AppCompatActivity, list: ArrayList<String>, requestCodePix: Int) {
        Pix.start(context, Options.init().apply {
            requestCode = requestCodePix
            count = 5
            preSelectedUrls = list
        })
    }
}

and then pass it to editOptions like this:

    editOptions = EditOptions.init().apply {
        requestCode = REQUEST_IMAGE_EDIT
        addMoreImagesListener = mAddMoreListener
    }

This will solve the problem and editor will open now, but this editor is very buggy. You cannot crop properly it messes the ratio. it randomly crashes sometimes. @akshay2211 If you can solve these some bugs, that would be very helpful. I'm using PixImagePicker library and that's great. And I want use editor with ImagePicker because the design is similar, I hope you can do that maybe.

Parag2385 avatar Jun 16 '20 08:06 Parag2385

Hey @Parag2385 i really want to resolve these bugs, but due to scarcity of time i am unable to do so, may be next month ill give it a go. If you want to contribute in PixEditor you are most welcome.

akshay2211 avatar Jun 16 '20 15:06 akshay2211