You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter permission_handler请求权限报MissingPluginException异常

基础信息
  • 测试覆盖Android、Linux两个平台,两个平台均会复现该问题
  • 已按照pub.dev上对应库的官方文档完成相关配置,修改了grade.properties与android/app/build.gradle文件
问题描述

permission_handler库无法正常工作,测试使用的权限请求代码为官方给出的示例代码,具体如下:

import 'package:permission_handler/permission_handler.dart';

class Perms {
  void requestPermissions() async {
    if (await Permission.storage.request().isGranted) {
      print("Granted.");
    }
  }
}

运行到上述代码块时触发如下报错:

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method checkPermissionStatus on channel flutter.baseflow.com/permissions/methods)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
<asynchronous suspension>
#1      MethodChannelPermissionHandler.checkPermissionStatus (package:permission_handler_platform_interface/src/method_channel/method_channel_permission_handler.dart:16:20)
<asynchronous suspension>
#2      Perms.requestPermissions (package:passync/perms.dart:5:18)
<asynchronous suspension>

主目录下的AndroidManifest.xml文件内容如下,debug、profile目录下还存在其他清单文件,暂不确定是否需要在这些文件中也添加相同的权限配置:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.passync">
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
   <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

   <application
        android:label="passync"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
已尝试的解决方案
  • 新建空白项目复刻相同代码与配置,最终仍出现相同错误
  • 执行flutter clean命令清理项目缓存后重新编译,问题仍未解决
  • 尝试请求其他权限验证是否为存储权限专属问题,结果请求不同权限时均抛出相同错误

如需补充其他排查信息可随时告知,会及时更新内容。


内容的提问来源于stack exchange,提问作者AlphabetsAlphabets

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.26 14:18:19