flutter image_cropper crash Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of flutter image_cropper crash without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I tried crop image with this plugin and worked great on iOS but on Android, app will crash. Console says like those.

V/BoostFramework(22266): mAcquireFunc method = public int com.qualcomm.qti.Performance.perfLockAcquire(int,int[]) V/BoostFramework(22266): mReleaseFunc method = public int com.qualcomm.qti.Performance.perfLockRelease() V/BoostFramework(22266): mAcquireTouchFunc method = public int com.qualcomm.qti.Performance.perfLockAcquireTouch(android.view.MotionEvent,android.util.DisplayMetrics,int,int[]) V/BoostFramework(22266): mIOPStart method = public int com.qualcomm.qti.Performance.perfIOPrefetchStart(int,java.lang.String) V/BoostFramework(22266): mIOPStop method = public int com.qualcomm.qti.Performance.perfIOPrefetchStop() V/BoostFramework(22266): BoostFramework() : mPerf = com.qualcomm.qti.Performance@544293f W/art (22266): Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable D/BitmapLoadUtils(22266): maxBitmapSize: 2078 D/BitmapWorkerTask(22266): Uri scheme: file E/TransformImageView(22266): onFailure: setImageUri E/TransformImageView(22266): java.io.FileNotFoundException: Permission denied E/TransformImageView(22266): at android.os.Parcel.openFileDescriptor(Native Method) E/TransformImageView(22266): at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:283) E/TransformImageView(22266): at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:200) E/TransformImageView(22266): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:981) E/TransformImageView(22266): at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:839) E/TransformImageView(22266): at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:793) E/TransformImageView(22266): at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:100) E/TransformImageView(22266): at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:44) E/TransformImageView(22266): at android.os.AsyncTask$2.call(AsyncTask.java:305) E/TransformImageView(22266): at java.util.concurrent.FutureTask.run(FutureTask.java:237) E/TransformImageView(22266): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) E/TransformImageView(22266): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) E/TransformImageView(22266): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) E/TransformImageView(22266): at java.lang.Thread.run(Thread.java:761) E/AndroidRuntime(22266): FATAL EXCEPTION: main E/AndroidRuntime(22266): Process: com.example.droidemo, PID: 22266 E/AndroidRuntime(22266): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=69, result=96, data=Intent { (has extras) }} to activity {com.example.droidemo/com.example.droidemo.MainActivity}: java.lang.IllegalArgumentException: Unsupported value: java.io.FileNotFoundException: Permission denied E/AndroidRuntime(22266): at android.app.ActivityThread.deliverResults(ActivityThread.java:4211) E/AndroidRuntime(22266): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4254) E/AndroidRuntime(22266): at android.app.ActivityThread.-wrap20(ActivityThread.java) E/AndroidRuntime(22266): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584) E/AndroidRuntime(22266): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(22266): at android.os.Looper.loop(Looper.java:154) E/AndroidRuntime(22266): at android.app.ActivityThread.main(ActivityThread.java:6242) E/AndroidRuntime(22266): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(22266): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) E/AndroidRuntime(22266): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779) E/AndroidRuntime(22266): Caused by: java.lang.IllegalArgumentException: Unsupported value: java.io.FileNotFoundException: Permission denied E/AndroidRuntime(22266): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:293) E/AndroidRuntime(22266): at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70) E/AndroidRuntime(22266): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:208) E/AndroidRuntime(22266): at vn.hunghd.flutter.plugins.imagecropper.ImageCropperDelegate.finishWithError(ImageCropperDelegate.java:99) E/AndroidRuntime(22266): at vn.hunghd.flutter.plugins.imagecropper.ImageCropperDelegate.onActivityResult(ImageCropperDelegate.java:82) E/AndroidRuntime(22266): at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:210) E/AndroidRuntime(22266): at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:139) E/AndroidRuntime(22266): at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:138) E/AndroidRuntime(22266): at android.app.Activity.dispatchActivityResult(Activity.java:7009) E/AndroidRuntime(22266): at android.app.ActivityThread.deliverResults(ActivityThread.java:4207) E/AndroidRuntime(22266): … 9 more Lost connection to device. Exited (sigterm)

Does anyone know how to fix this?

Answer

On Android Platform, we are required config UCropActivity into AndroidManifest.xml below application. IOS is not required to do that.

Read detail on: https://pub.dev/packages/image_cropper

<activity             
    android:name="com.yalantis.ucrop.UCropActivity"             
    android:screenOrientation="portrait"             
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
We are here to answer your question about flutter image_cropper crash - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji