4

I'm using image_picker flutter package but when I use it like the defined example, it does not work. if I call the function for the first time:

ImagePicker.pickImage(source: ImageSource.camera, maxWidth: 600);

I get this error and nothing happends:

PlatformException(error, Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference, null)

And when I call that for the second time I get this error:

PlatformException(already_active, Image picker is already active, null)

sometimes it does not even log any error and just logs and does nothing:

D/ViewRootImpl@abff78a[MainActivity](31877): MSG_WINDOW_FOCUS_CHANGED 0
D/ViewRootImpl@abff78a[MainActivity](31877): MSG_WINDOW_FOCUS_CHANGED 1
D/ViewRootImpl@abff78a[MainActivity](31877): Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x1 surface={valid=true 3524769792} changed=false

can anyone help me with this?

Moein Hosseini
  • 1,514
  • 3
  • 15
  • 33
  • Same here, it's happening only on Linux, emulator (API 28). I also have a Mac and it works there. Unfortunately I cannot tell if this happens on the real device, since I currently don't have one – maddob May 21 '19 at 05:24

1 Answers1

0

This issue only happens on older versions of the plugin. Updating the Flutter SDK and image_picker plugin to the latest version should fix the issue.

Omatt
  • 8,564
  • 2
  • 42
  • 144