17

I am implementing image_picker in my app. That is not showing any warning or message but when I run it in Android simulator it shows me an error in console:

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)
E/flutter ( 5074): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)
E/flutter ( 5074): <asynchronous suspension>
E/flutter ( 5074): #1      ImagePicker.pickImage (package:image_picker/image_picker.dart:53:40)
E/flutter ( 5074): <asynchronous suspension>
Code Hunter
  • 10,075
  • 23
  • 72
  • 102

23 Answers23

54

I solved my problem by simply run following command:

flutter clean 

After this my Android simulator start working correctly.

Code Hunter
  • 10,075
  • 23
  • 72
  • 102
16

When you add a new dependency and you get this error, you should stop the app and run it again from cold. Hot restart will not work.

Abdou Ouahib
  • 821
  • 5
  • 14
12

First, make sure you clean your flutter project

flutter clean

then in Android studio, File > Invalidate and caches restart

flutter run
7

Just uninstall app from your simulator and clean project by flutter clean and then flutter run

Abir Ahsan
  • 2,649
  • 29
  • 51
6

I had the same issue

For anyone who happens to stumble accros this... Just Stop the app, and run it again

just a simple "turn it off and on again!"

z4rtx
  • 127
  • 1
  • 8
3

I am facing the same issue but none of the answers mentioned above help with this problem after digging in, I find out that the minSdkVersion required for the library for android is above 19 so GO to android-> app-> build.gradle change the minSdkVersion to 19 and run app from cold start.

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "you package name"
        minSdkVersion 19   // <--here is the changes 
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
Atul Chaudhary
  • 1,491
  • 2
  • 15
  • 23
2

For those who still having problems on Android, this one solved mine..

For some reason image_picker plugin haven't been registered automacally

Go to Android > app > main > java> io> flutter > plugins and edit GeneratedPluginRegistrant.java

  1. import io.flutter.plugins.imagepicker.ImagePickerPlugin;

  2. paste this line inside method registerWith ImagePickerPlugin.registerWith(registry.registrarFor("io.flutter.plugins.imagepicker.ImagePickerPlugin"));

victommasi
  • 339
  • 3
  • 10
  • Went though all the solutions, this one seemed to be the one standing out as some out of the box solution, also went tried out @daljit-singh 's solution below but it too didnt work. Is there another way around it? – DeprecatedAPI Feb 04 '21 at 10:48
2

This happens when you add a dependency to pubsec yaml file and hot-refresh the app. You should re-build / re-run the app then it works fine.

isarojdahal
  • 994
  • 8
  • 12
2

After removing the flutter_facebook_auth package, running flutter clean, flutter pub get and running the application, it will work properly

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
1

Since the latest update the static method pickImage is not available for some reasons. You will have to call methd getImage(source: ImageSource) for that purpose

    ImagePicker imagePicker = ImagePicker();
final imageFile = await imagePicker.getImage(source: ImageSource.camera);
Em Ikram
  • 161
  • 1
  • 3
1

Android #

API < 29

No configuration required - the plugin should work out of the box.

API 29+

Add android:requestLegacyExternalStorage="true" as an attribute to the tag in AndroidManifest.xml. The attribute is false by default on apps targeting Android Q.

After that :

flutter clean
flutter pub get
flutter run

And here you go coding again...

Japsimrans13
  • 84
  • 1
  • 3
1

If you are using flutter_facebook_auth you must configure it as shown in the documentation (https://facebook.meedu.app/#/android), otherwise, image_picker will not work correctly

Taken from the flutter_facebook_auth documentation

1

It is not a problem just When you add a new dependency and you get this error, you should stop the app and run it again.Hot restart will not work.

  • The only thing that worked for me is to stop and relaunch, even the clean flutter and pub get then play didn't work, you must force stop the app. thanks bro. – Nabil Ait Brahim Aug 17 '22 at 20:16
1

make sure that you give uses-permission in your AndroidManifest.xml android/app/src/main/AndroidManifest.xml

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

and after that run

flutter clean
flutter pub get
flutter run
0

Are you picking an image from camera or gallery? if you want to pick an image from the camera you need to use a real device, simulation gives error sometimes, make sure you are giving the source:

var image = await ImagePicker.pickImage(source: ImageSource.gallery);
Taym95
  • 2,331
  • 13
  • 14
0

Try to add :

import 'dart:async';

flutter clean

AmegoDev.
  • 301
  • 3
  • 10
0

Try by changing the image_picker version: image_picker: ^0.6.0+9

DALJIT SINGH
  • 111
  • 1
  • 11
0

Already follow all the responses but still not solve in my case. Still throwing "No implementation found for method pickImage on channel plugins.flutter.io/image_picker"

EM Farih
  • 67
  • 1
  • 9
  • 1
    Latest version facing this type of issue. Android working fine. But In iOS facing this issue. Did you find any solution for this?. – Karnan Muthukumar Jul 14 '21 at 07:37
  • I faced those issues on Android after Upgrading Flutter Version. The solution I tried is downgrading the Flutter and yes, it works. – EM Farih Jul 15 '21 at 08:08
0

I had the same issue. My solution was to remove another plugin: flutter-facebook-auth.

also, I found it here: github.com/flutter/flutter/issues/72898

Really informative comment:

Anyway, that's really bad situation when some plugin that is not used in the part of code crashes the app, and debug tells you that issues is with another one plugin.

dramf
  • 261
  • 3
  • 4
0

Simply stop your project and Run. It will work

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 09 '22 at 04:12
0

I just restarted my app and the error was gone. I will recommend you to do the same.

Hur bangash
  • 241
  • 1
  • 2
  • 4
-1

it is simple to fix. terminate the process and then restart. to terminate on vscode : open terminal on vscode and press " ctr + c" then press "y" and press "enter" .now restart your project .hope it will work. check it and comment me if it does not work.

habeshacoder
  • 109
  • 1
  • 5
-2

Updating the dependency solve my error.