You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 31, 2023. It is now read-only.
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)
The text was updated successfully, but these errors were encountered:
@rahulserver@ammykam The following method will return null if the file exists but isn't able to be decoded into a bitmap, perhaps not an image or an unexpected encoding. So in the java code adding a null check and returning an error is probably the best way to handle it. i.e.
Bitmap bmp = BitmapFactory.decodeFile(fileName);
if (bmp == null) {
result.error("File could not be decoded by BitmapFactory", fileName, null);
return;
}
Here is my code:
This gives below error on miui (Works fine on samsung or android emulator)
The text was updated successfully, but these errors were encountered: