【发布时间】:2019-12-12 01:29:54
【问题描述】:
我想从我的 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>
谢谢
【问题讨论】:
-
从相机或图库中读取图像?如果您尝试从厨房读取,则需要在 android 清单中声明读取存储权限。
标签: flutter imagepicker