为什么我的 Xamarin Android 应用程序突然需要外部存储权限? [英] Why does my Xamarin Android application suddenly require external storage permissions?

查看:39
本文介绍了为什么我的 Xamarin Android 应用程序突然需要外部存储权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Xamarin Android 应用程序,我一直在尝试为其创建更新.就在一切都连接好并工作时,我终于发布了 APK,我从 Google Play 收到一条消息,说上传的 APK 现在需要两个额外的权限.用于读取和写入外部存储!我的应用程序中根本不需要这些权限.我尝试查看我的项目的 Android 清单,但没有看到那里列出了此类权限.我的应用程序的旧版本(使用旧版本的 Xamarin Android)不需要这些权限.为什么 Xamarin 会突然注入我没有指定的权限?

I have a Xamarin Android application I've been trying to create an update for. Right when everything was hooked up and working, and I finally made the release APK, I get a message from Google Play that the uploaded APK now requires two extra permissions. For reading and writing to external storage! I don't need these permissions in my application at all. I tried looking at my project's Android Manifest, and saw no such permissions listed there. Older versions of my application (using older versions of Xamarin Android) did not require these permissions. Why would Xamarin suddenly be injecting permissions I didn't specify?

我可以确认任何应用程序都是如此.我刚刚用它创建了一个新的 android 应用程序,它需要外部读/写权限,没有明显的方法来禁用该要求

I can confirm that this is the case with any application. I just created a new android app with it, and it requires external read/write permissions, with no apparent way to disable that requirement

推荐答案

查看AssemblyInfo.cs,默认模板底部有这个:

Look in AssemblyInfo.cs, default template has this on the bottom of it:

[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

权限可以通过 AndroidManifest.xml 文件或通过 AssemblyInfo.cs 设置.删除那些行,权限就不用再设置了.

Permissions can be set either through the AndroidManifest.xml file or through AssemblyInfo.cs. Delete those lines, and the permissions should not be set anymore.

这篇关于为什么我的 Xamarin Android 应用程序突然需要外部存储权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆