hnvn / flutter_image_cropper

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

App Crash when the Image crop #115

Open a4arun2010 opened 4 years ago

a4arun2010 commented 4 years ago

AndroidManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.flutter_click_pick_crop_compress">

<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="flutter_click_pick_crop_compress"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>

ERROR Launching lib\main.dart on SM J250F in debug mode... √ Built build\app\outputs\apk\debug\app-debug.apk. D/FlutterActivity(26434): Using the launch theme as normal theme. D/FlutterActivityAndFragmentDelegate(26434): Setting up FlutterEngine. D/FlutterActivityAndFragmentDelegate(26434): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment. D/FlutterActivityAndFragmentDelegate(26434): Attaching FlutterEngine to the Activity that owns this Fragment. D/FlutterView(26434): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@1ce3026 D/FlutterActivityAndFragmentDelegate(26434): Executing Dart entrypoint: main, and sending initial route: / I/flutter (26434): null D/ViewRootImpl@e068768MainActivity: ViewPostImeInputStage processPointer 0 D/ViewRootImpl@e068768MainActivity: ViewPostImeInputStage processPointer 1 D/ViewRootImpl@e068768MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 D/SurfaceView(26434): Relayout returned: oldFrame=[0,0][540,960] newFrame=[0,0][540,960] result=0x5 surface={Surface(name=null)/@0xada4467 isValid=false 0} D/ViewRootImpl@e068768MainActivity: mHardwareRenderer.destroy()#1 D/ViewRootImpl@e068768MainActivity: Relayout returned: oldFrame=[0,0][540,960] newFrame=[0,0][540,960] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true D/InputTransport(26434): Input channel destroyed: fd=78 D/FlutterView(26434): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@1ce3026 V/InputMethodManager(26434): Starting input: tba=android.view.inputmethod.EditorInfo@2bd1c0a nm : com.example.flutter_click_pick_crop_compress ic=null I/InputMethodManager(26434): startInputInner - mService.startInputOrWindowGainedFocus D/ViewRootImpl@e068768MainActivity: mHardwareRenderer.destroy()#1 D/ViewRootImpl@e068768MainActivity: Relayout returned: oldFrame=[0,0][540,960] newFrame=[0,0][540,960] result=0x1 surface={isValid=false 0} surfaceGenerationChanged=false D/SurfaceView(26434): Relayout returned: oldFrame=[0,0][540,960] newFrame=[0,0][540,960] result=0x7 surface={Surface(name=null)/@0xada4467 isValid=true -2131247104} D/ViewRootImpl@e068768MainActivity: Relayout returned: oldFrame=[0,0][540,960] newFrame=[0,0][540,960] result=0x7 surface={isValid=true -2120034304} surfaceGenerationChanged=true D/ViewRootImpl@e068768MainActivity: mHardwareRenderer.initialize() mSurface={isValid=true -2120034304} hwInitialized=true D/FlutterView(26434): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@1ce3026 V/InputMethodManager(26434): Starting input: tba=android.view.inputmethod.EditorInfo@89e9a98 nm : com.example.flutter_click_pick_crop_compress ic=null I/InputMethodManager(26434): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(26434): Input channel constructed: fd=79 W/Activity(26434): AppLock checkAppLockState locked:false verifying:false pkgName = com.example.flutter_click_pick_crop_compress isInMultiWindowMode:false showWhenLocked:false D/ViewRootImpl@e068768MainActivity: MSG_WINDOW_FOCUS_CHANGED 1 D/ViewRootImpl@e068768MainActivity: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true -2120034304} V/InputMethodManager(26434): Starting input: tba=android.view.inputmethod.EditorInfo@83252f1 nm : com.example.flutter_click_pick_crop_compress ic=null I/InputMethodManager(26434): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(26434): Input channel constructed: fd=80 D/InputTransport(26434): Input channel destroyed: fd=79 D/skia (26434): libjpeg error 122 from output_message I/ExifInterface_JNI(26434): Raw image not detected I/ExifInterface_JNI(26434): Raw image not detected D/ViewRootImpl@e068768MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 W/art (26434): Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.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 I/art (26434): Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener; I/art (26434): at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2421) I/art (26434): at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:779) I/art (26434): at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:659) I/art (26434): at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:552) I/art (26434): at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:161) I/art (26434): at void com.yalantis.ucrop.UCropActivity.onCreate(android.os.Bundle) (UCropActivity.java:122) I/art (26434): at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6977) I/art (26434): at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126) I/art (26434): at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2946) I/art (26434): at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3064) I/art (26434): at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1) I/art (26434): at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1659) I/art (26434): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102) I/art (26434): at void android.os.Looper.loop() (Looper.java:154) I/art (26434): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6816) I/art (26434): at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2) I/art (26434): at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1565) I/art (26434): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1453) I/art (26434): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.example.flutter_click_pick_crop_compress-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.flutter_click_pick_crop_compress-2/lib/arm, /data/app/com.example.flutter_click_pick_crop_compress-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] I/art (26434): at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56) I/art (26434): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380) I/art (26434): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) I/art (26434): at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2421) I/art (26434): at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:779) I/art (26434): at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:659) I/art (26434): at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:552) I/art (26434): at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:161) I/art (26434): at void com.yalantis.ucrop.UCropActivity.onCreate(android.os.Bundle) (UCropActivity.java:122) I/art (26434): at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6977) I/art (26434): at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126) I/art (26434): at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2946) I/art (26434): at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3064) I/art (26434): at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1) I/art (26434): at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1659) I/art (26434): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102) I/art (26434): at void android.os.Looper.loop() (Looper.java:154) I/art (26434): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6816) I/art (26434): at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2) I/art (26434): at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1565) I/art (26434): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1453) I/art (26434): D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/BitmapLoadUtils(26434): maxBitmapSize: 1101 D/BitmapWorkerTask(26434): Uri scheme: file D/ViewRootImpl@933a7c3UCropActivity: ThreadedRenderer.create() translucent=false D/InputTransport(26434): Input channel constructed: fd=92 D/ViewRootImpl@933a7c3UCropActivity: setView = DecorView@bee0840[UCropActivity] touchMode=true W/Activity(26434): AppLock checkAppLockState locked:false verifying:false pkgName = com.example.flutter_click_pick_crop_compress isInMultiWindowMode:false showWhenLocked:false D/ViewRootImpl@933a7c3UCropActivity: dispatchAttachedToWindow D/ViewRootImpl@933a7c3UCropActivity: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,0][540,960] result=0x27 surface={isValid=true -2072000512} surfaceGenerationChanged=true D/ViewRootImpl@933a7c3UCropActivity: mHardwareRenderer.initialize() mSurface={isValid=true -2072000512} hwInitialized=true I/ViewConfigCompat(26434): Could not find method getScaledScrollFactor() on ViewConfiguration D/TextView(26434): setTypeface with style : 0 D/TextView(26434): setTypeface with style : 0 D/ViewRootImpl@933a7c3UCropActivity: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 540, 960) ci=Rect(0, 36 - 0, 0) vi=Rect(0, 36 - 0, 0) or=1 D/ViewRootImpl@933a7c3UCropActivity: MSG_WINDOW_FOCUS_CHANGED 1 D/ViewRootImpl@933a7c3UCropActivity: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true -2072000512} V/InputMethodManager(26434): Starting input: tba=android.view.inputmethod.EditorInfo@21c0fc nm : com.example.flutter_click_pick_crop_compress ic=null I/InputMethodManager(26434): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(26434): Input channel constructed: fd=93 D/InputTransport(26434): Input channel destroyed: fd=80 D/TransformImageView(26434): Image size: [640:360] D/TextView(26434): setTypeface with style : 0 D/SurfaceView(26434): Relayout returned: oldFrame=[0,0][540,960] newFrame=[0,0][540,960] result=0x5 surface={Surface(name=null)/@0xada4467 isValid=false 0} D/ViewRootImpl@e068768MainActivity: mHardwareRenderer.destroy()#1 D/ViewRootImpl@e068768MainActivity: Relayout returned: oldFrame=[0,0][540,960] newFrame=[0,0][540,960] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true D/FlutterView(26434): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@1ce3026 D/ViewRootImpl@933a7c3UCropActivity: ViewPostImeInputStage processPointer 0 D/ViewRootImpl@933a7c3UCropActivity: ViewPostImeInputStage processPointer 1 I/BitmapCropTask(26434): Should crop: true D/TextView(26434): setTypeface with style : 0 D/AndroidRuntime(26434): Shutting down VM E/AndroidRuntime(26434): FATAL EXCEPTION: main E/AndroidRuntime(26434): Process: com.example.flutter_click_pick_crop_compress, PID: 26434 E/AndroidRuntime(26434): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=69, result=-1, data=Intent { launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 }(has extras) }} to activity {com.example.flutter_click_pick_crop_compress/com.example.flutter_click_pick_crop_compress.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference E/AndroidRuntime(26434): at android.app.ActivityThread.deliverResults(ActivityThread.java:4556) E/AndroidRuntime(26434): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4599) E/AndroidRuntime(26434): at android.app.ActivityThread.-wrap22(ActivityThread.java) E/AndroidRuntime(26434): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1715) E/AndroidRuntime(26434): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(26434): at android.os.Looper.loop(Looper.java:154) E/AndroidRuntime(26434): at android.app.ActivityThread.main(ActivityThread.java:6816) E/AndroidRuntime(26434): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(26434): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1565) E/AndroidRuntime(26434): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1453) E/AndroidRuntime(26434): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference E/AndroidRuntime(26434): at vn.hunghd.flutter.plugins.imagecropper.ImageCropperDelegate.finishWithSuccess(ImageCropperDelegate.java:110) E/AndroidRuntime(26434): at vn.hunghd.flutter.plugins.imagecropper.ImageCropperDelegate.onActivityResult(ImageCropperDelegate.java:94) E/AndroidRuntime(26434): at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEnginePluginRegistry.java:634) E/AndroidRuntime(26434): at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult(FlutterEnginePluginRegistry.java:367) E/AndroidRuntime(26434): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:546) E/AndroidRuntime(26434): at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:594) E/AndroidRuntime(26434): at android.app.Activity.dispatchActivityResult(Activity.java:7337) E/AndroidRuntime(26434): at android.app.ActivityThread.deliverResults(ActivityThread.java:4552) E/AndroidRuntime(26434): ... 9 more Lost connection to device. Exited (sigterm)

RodolfoSilva commented 4 years ago

Duplicated #113

tomtanti commented 4 years ago

Even on v1.1.2, this crash can be reproduced by enabling Don't keep activities in the Developer options.