0

I want to select a image from my android emulator and then upload it to cloud storage. When I call File image = await ImagePicker.pickImage(source: ImageSource.gallery); I get error as follows:

MissingPluginException(No implementation found for method requestPermissions on channel flutter.baseflow.com/permissions/methods)

I tried to put camera permission in AndroidManifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.somethingdwun.dwun">

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

    <application
        android:name="io.flutter.app.FlutterApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="dwun">
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.yalantis.ucrop.UCropActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
    </application>
</manifest>

Thanks

Aseem
  • 5,848
  • 7
  • 45
  • 69
  • read image from camera or gallery? If you're trying to read from galley you need to declared read storage permission in the android manifest. – OMi Shah Dec 12 '19 at 04:54

3 Answers3

1

And i found thisMissingPluginException

No need to add permissions in AndroidManifest.xml file. Close your app, go in project directory & try running this in command line:

flutter clean

I think it will solve your problem

Aseem
  • 5,848
  • 7
  • 45
  • 69
reza47
  • 650
  • 6
  • 16
  • I didnt have to add any permissions in AndroidManifest.xml. ImagePicker() works directly after `flutter clean` in flutter project directory. – Aseem Dec 13 '19 at 00:17
0

Did you add that in to your dependency?

First, add image_picker as a dependency in your pubspec.yaml file. Hope it will helps you

dependencies: image_picker: ^0.6.2+3

reza47
  • 650
  • 6
  • 16
0

sometime hot restart or hot reload won't do the trick. make sure you add image_picker as a dependency in your pubspec.yaml file

Close the app and execute flutter run command.

Jaydeep chatrola
  • 2,423
  • 11
  • 17