Skip to content
This repository was archived by the owner on May 31, 2023. It is now read-only.
This repository was archived by the owner on May 31, 2023. It is now read-only.

Miui Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference #92

@rahulserver

Description

@rahulserver

Here is my code:

  File compressedFile = await FlutterNativeImage.compressImage(file.path,
      quality: 25);

This gives below error on miui (Works fine on samsung or android emulator)

E/MethodChannel#flutter_native_image(10761): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
E/MethodChannel#flutter_native_image(10761): 	at com.example.flutternativeimage.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:48)
E/MethodChannel#flutter_native_image(10761): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#flutter_native_image(10761): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/MethodChannel#flutter_native_image(10761): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/MethodChannel#flutter_native_image(10761): 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$6ZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown Source:12)
E/MethodChannel#flutter_native_image(10761): 	at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#flutter_native_image(10761): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#flutter_native_image(10761): 	at android.os.Looper.loop(Looper.java:236)
E/MethodChannel#flutter_native_image(10761): 	at android.app.ActivityThread.main(ActivityThread.java:8031)
E/MethodChannel#flutter_native_image(10761): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_native_image(10761): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
E/MethodChannel#flutter_native_image(10761): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions