animeng / flutter_export_video_frame

Export picture from video file
MIT License
15 stars 20 forks source link

Attempt to invoke virtual method 'int android.content.Context.checkPermission' #15

Open saurabhkumar8112 opened 1 year ago

saurabhkumar8112 commented 1 year ago

Using v0.0.7 Platform Flutter v3.7.1

Unable to run exportImage. I have added the required permission in android_manifest.xml


<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

I still get exception thrown from checkPermission module. Please have a look at the stack trace

Error Stack

/MethodChannel#export_video_frame(31548):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
E/flutter (31548): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference
E/flutter (31548):  at androidx.core.content.ContextCompat.checkSelfPermission(ContextCompat.java:601)
E/flutter (31548):  at com.mengtnt.export_video_frame.PermissionManager.isPermissionGranted(PermissionManager.java:53)
E/flutter (31548):  at com.mengtnt.export_video_frame.ExportVideoFramePlugin.onMethodCall(ExportVideoFramePlugin.java:65)
E/flutter (31548):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/flutter (31548):  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter (31548):  at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/flutter (31548):  at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter (31548):  at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (31548):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (31548):  at android.os.Looper.loop(Looper.java:236)
E/flutter (31548):  at android.app.ActivityThread.main(ActivityThread.java:8087)
E/flutter (31548):  at java.lang.reflect.Method.invoke(Native Method)
E/flutter (31548):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
E/flutter (31548):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
E/flutter (31548): )
E/flutter (31548): #0      StandardMethodCodec.decodeEnvelope
message_codecs.dart:653
E/flutter (31548): #1      MethodChannel._invokeMethod
platform_channel.dart:315
E/flutter (31548): <asynchronous suspension>
E/flutter (31548): #2      ExportVideoFrame.exportImage
export_video_frame.dart:95
ujjawalsofvare commented 1 year ago

Have you found any solution?