当前位置: 首页 > 知识库问答 >
问题:

颤振:如何从ImagePicker软件包的设备中读取图像

郁高韵
2023-03-14

我想从我的android模拟器中选择一个图像,然后将其上传到云存储。当我调用File image=wait 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>

谢啦

共有3个答案

郭知
2023-03-14

有时,热重启或热重新加载不会起作用。确保在pubspec中添加图像选择器作为依赖项。yaml文件

关闭应用程序并执行flatter run命令。

梅跃
2023-03-14

你把它加到你的依赖中了吗?

首先,添加

依赖项:图像选取器:^0.6.2 3

诸福
2023-03-14

我发现了这个缺失

无需在AndroidManifest中添加权限。xml文件。关闭应用程序,进入项目目录

flutter clean

我想这会解决你的问题

 类似资料:
  • 我有一个文本文件(.txt),我想成为以后可以扫描的资源。 在pubspec.yaml,我已经确保: 存在。该文件位于我创建的文件夹中,与和处于同一级别 我试图从自定义类读取文件,而不是小部件。 根据文档,我将使用此导入: 然后开始这样读: 要获得实际数据,请执行以下操作: 但是,当我使用

  • E/flatter(31135):[错误:flatter/lib/ui/ui\u dart\u state.cc(186)]未处理的异常:MissingPluginException(未找到通道颤振上的方法speak的实现)E/flatter(31135):\0 MethodChannel_调用方法(包:颤振/src/services/platform_channel.dart:156:7)E/颤

  • 在Android中,我们有,<代码>设置。保护ANDROID\u ID。我不知道iOS的等效版本。在flutter中是否有一个flutter插件或一种方法可以为Android和IOS获取唯一的设备id?

  • 我不确定这是否是合适的堆栈交换站点,但我认为它比我能想到的其他站点更适合这里。无论如何,我为一个移动应用程序开发团队工作,我们正在考虑使用Flutter来开发我们未来的移动应用程序,因为它减少了为iOS和Android开发时所需的工作量(我们只是一个小团队)。 我通读了一些关于Flutter的信息,并检查了可用的软件包和Dart /Flutter Pub,还有一些软件包尚未可用于我们用于Andro

  • 我正在为android应用程序开发一个Flutter模块,该模块使用Geolocatore获取设备的当前位置。但当flutter模块初始化时,我得到了以下错误: location_permissions:无法检测当前activity 我已经将这两行添加到AndroidManifest文件中(用于Android应用程序和flutter模块2) 我使用这个函数来获取当前位置