ricnaaru / adv_camera

Advanced Camera for Flutter
BSD 3-Clause "New" or "Revised" License
55 stars 37 forks source link

Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'android.hardware.Camera$Parameters android.hardware.Camera.getParameters()' on a null object reference #6

Closed DesortsSolution closed 4 years ago

DesortsSolution commented 4 years ago

E/flutter (27234): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'android.hardware.Camera$Parameters android.hardware.Camera.getParameters()' on a null object reference, null) E/flutter (27234): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7) E/flutter (27234): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33) E/flutter (27234): E/flutter (27234): #2 AdvCameraController.setPreviewRatio (package:adv_camera/controller.dart:97:34) E/flutter (27234):

ricnaaru commented 4 years ago

please note this

For Android's permission, you have to configure it yourself (using Dexter, etc.). This plugin is made to support my other plugin adv_image_picker, so this permission is handled in adv_image_picker

On Android, you have to request permission manually, you can use dexter or another permission requestor plugin on Java. or you can see my code at adv_image_picker

or you can manually set camera permission on Android setting