hnvn / flutter_image_cropper

A Flutter plugin for Android and iOS supports cropping images
1k stars 392 forks source link

NoClassDefFoundError: Failed resolution of: Lcom/yalantis/ucrop/UCrop$Options on Android SDK 33 #441

Open vedo1608 opened 1 year ago

vedo1608 commented 1 year ago

Upgraded my compileSDKversion and targetSDKversion to 33. When I try and crop the image, I get the following error:

                    at vn.hunghd.flutter.plugins.imagecropper.ImageCropperDelegate.startCrop(ImageCropperDelegate.java:63)
                    at vn.hunghd.flutter.plugins.imagecropper.ImageCropperPlugin.onMethodCall(ImageCropperPlugin.java:59)
                    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
                    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
                    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
                    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
                    at android.os.Handler.handleCallback(Handler.java:942)
                    at android.os.Handler.dispatchMessage(Handler.java:99)
                    at android.os.Looper.loopOnce(Looper.java:201)
                    at android.os.Looper.loop(Looper.java:288)
                    at android.app.ActivityThread.main(ActivityThread.java:7918)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
                 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.yalantis.ucrop.UCrop$Options" on path: DexPathList[[zip file "/data/app/~~gkC02S9NMvDA6VI5RQyBVw==/com.mop.novacircle.dev-u2mUE31CmVGM3Yr8VSSOgQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~gkC02S9NMvDA6VI5RQyBVw==/com.mop.novacircle.dev-u2mUE31CmVGM3Yr8VSSOgQ==/lib/arm64, /data/app/~~gkC02S9NMvDA6VI5RQyBVw==/com.mop.novacircle.dev-u2mUE31CmVGM3Yr8VSSOgQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
                    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                    at vn.hunghd.flutter.plugins.imagecropper.ImageCropperDelegate.startCrop(ImageCropperDelegate.java:63) 
                    at vn.hunghd.flutter.plugins.imagecropper.ImageCropperPlugin.onMethodCall(ImageCropperPlugin.java:59) 
                    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258) 
                    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295) 
                    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322) 
                    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) 
                    at android.os.Handler.handleCallback(Handler.java:942) 
                    at android.os.Handler.dispatchMessage(Handler.java:99) 
                    at android.os.Looper.loopOnce(Looper.java:201) 
                    at android.os.Looper.loop(Looper.java:288) 
                    at android.app.ActivityThread.main(ActivityThread.java:7918) 
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

I have multidex enabled. This only happens on Android devices, iOS works good. I can see on UCrop github that the last release was updated to support API 31, is it possible that it does not work on API 33?