我想从我的Android模拟器中选择一个图像,然后将其上传到云存储。当我致电File image = await ImagePicker.pickImage(source: ImageSource.gallery);
时,出现如下错误:
MissingPluginException(No implementation found for method requestPermissions on channel flutter.baseflow.com/permissions/methods)
我试图将摄像头权限放入AndroidManifest.xml文件中
<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>
谢谢
答案 0 :(得分:1)
我发现了这个MissingPluginException
无需在AndroidManifest.xml文件中添加权限。关闭您的应用,进入项目目录并尝试在命令行中运行它:
flutter clean
我认为它将解决您的问题
答案 1 :(得分:0)
您是否已将其添加到依赖项中?
首先,在您的pubspec.yaml文件中添加image_picker作为依赖项。 希望对您有帮助
依赖项:image_picker:^ 0.6.2 + 3
答案 2 :(得分:0)
有时热重启或热重装无法解决问题。
确保在pubspec.yaml
文件中添加image_picker作为依赖项
关闭应用程序并执行flutter run
命令。