No implementation found for method pickImage on channel plugins.flutter.io/image_picke
Asked Answered
B

24

18

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>
Bornu answered 23/7, 2019 at 11:24 Comment(1)
Did you try hot reloading?Malanie
B
56

I solved my problem by simply run following command:

flutter clean 

After this my Android simulator start working correctly.

Bornu answered 23/7, 2019 at 12:27 Comment(1)
After this run : flutter pub get Fanchette
L
18

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.

Lowland answered 23/7, 2019 at 12:27 Comment(0)
V
13

First, make sure you clean your flutter project

flutter clean

then in Android studio, File > Invalidate and caches restart

flutter run
Valedictorian answered 5/10, 2020 at 12:46 Comment(0)
P
7

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

Photosynthesis answered 24/10, 2020 at 7:41 Comment(0)
S
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!"

Scholastic answered 6/2, 2021 at 21:16 Comment(0)
D
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"
    }
Decretal answered 13/1, 2020 at 14:14 Comment(0)
O
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"));

Orwin answered 24/12, 2019 at 14:37 Comment(1)
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?Rheotropism
S
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.

Simulator answered 25/6, 2020 at 3:44 Comment(0)
V
2

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

Vitric answered 31/8, 2021 at 12:45 Comment(0)
A
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);
Austenite answered 15/3, 2021 at 8:46 Comment(0)
C
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...

Carlocarload answered 28/4, 2021 at 14:33 Comment(0)
A
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

Argumentum answered 12/8, 2021 at 22:36 Comment(0)
A
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.

Acred answered 12/4, 2022 at 10:25 Comment(1)
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.Quentin
A
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
Armillia answered 20/7, 2022 at 9:10 Comment(0)
P
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);
Pulcheria answered 23/7, 2019 at 11:47 Comment(0)
C
0

Try to add :

import 'dart:async';

flutter clean

Conspicuous answered 10/3, 2020 at 14:58 Comment(0)
S
0

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

So answered 4/7, 2020 at 6:27 Comment(0)
O
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"

Oscillograph answered 25/6, 2021 at 1:27 Comment(2)
Latest version facing this type of issue. Android working fine. But In iOS facing this issue. Did you find any solution for this?.Metencephalon
I faced those issues on Android after Upgrading Flutter Version. The solution I tried is downgrading the Flutter and yes, it works.Oscillograph
P
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.

Profusive answered 23/7, 2021 at 12:20 Comment(0)
I
0

Simply stop your project and Run. It will work

Iconology answered 7/11, 2022 at 8:37 Comment(1)
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.Slover
P
0

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

Penman answered 6/5, 2023 at 9:11 Comment(0)
V
0

In my case, flutter clean was not worked for my app.

I solved my problem by Uninstalling my app from emulator/device and then rebuild my app and the error was gone.

Verlinevermeer answered 17/11, 2023 at 17:15 Comment(0)
N
-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.

Nkvd answered 9/12, 2022 at 7:53 Comment(0)
J
-2

Updating the dependency solve my error.

Jase answered 23/3, 2021 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.