Flutter读取文件列表在Android 10设备上出现权限报错问题求助
Flutter读取文件列表在Android 10设备上出现权限报错问题求助
嗨,各位大佬,我碰到一个权限相关的棘手问题,实在搞不定了,来求助大家!
我在Flutter应用里做文件列表展示的功能,在Android 13的模拟器上运行完全正常,但换到自己的Android 10真机时,就会弹出报错:
No permissions found in manifest for: []33, No permissions found in manifest for: []22
下面是我的权限请求代码:
void getPermissions() async { List<Permission> permissions = [ Permission.storage, Permission.manageExternalStorage, Permission.audio, ]; for (var permission in permissions) { var status = await permission.status; if (status.isDenied) { await permission.request(); } } setState(() {}); }
还有AndroidManifest.xml的内容:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/> <application android:label="music_app" 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命令清理项目,还降级了permission_handler包的版本,但问题依然存在。有没有大佬能帮我看看这是哪里出问题了?
备注:内容来源于stack exchange,提问作者BabaYagaPROP
相关产品推荐
相关产品推荐

