eclipse 为什么显示错误权限仅授予 android manifest 中的系统应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13914092/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why show error Permission is only granted to system apps in android manifest
提问by mum
I added these permissions to my app some months ago, and Eclipse never showed and error:
几个月前我将这些权限添加到我的应用程序中,Eclipse 从未显示和错误:
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
Today, however, I edited the Android manifest file, and now it shows an error:
然而,今天我编辑了 Android 清单文件,现在它显示了一个错误:
Permission is only granted to system apps
Permission is only granted to system apps
Why? How do I fix this problem?
为什么?我该如何解决这个问题?
回答by Edward Falk
Eclipse is doing you a favor -- that really is an error. Only apps signed with Google's signing key can install or delete apps.
Eclipse 正在帮您一个忙——这确实是一个错误。只有使用 Google 签名密钥签名的应用才能安装或删除应用。
You can probably suppress those error messages by configuring your lint options in Eclipse (see https://stackoverflow.com/a/16457801/338479), but unless you actually work for Google and have access to their signing key, you can't set those permissions.
您可以通过在 Eclipse 中配置 lint 选项来抑制这些错误消息(请参阅https://stackoverflow.com/a/16457801/338479),但除非您确实为 Google 工作并有权访问他们的签名密钥,否则您不能设置这些权限。
Well, maybe on a rooted device, but your app won't exactly be portable.
好吧,也许在有根设备上,但您的应用程序不会完全便携。
Edit: or did you change your SDK target version? Perhaps older versions of Android allowed you to have those permissions, but now you've targeted a version that doesnt?
编辑:或者您是否更改了您的 SDK 目标版本?也许旧版本的 Android 允许您拥有这些权限,但现在您的目标是一个没有这些权限的版本?
回答by Sathish
In Eclipse:
在日食中:
Window -> Preferences -> Android -> Lint Error Checking.
In the list find an entry with ID = ProtectedPermission.
Set the Severity to something lower than Error. This way you can still compile the project using Eclipse.
在列表中找到ID = ProtectedPermission.
将严重性设置为低于错误的条目。这样您仍然可以使用 Eclipse 编译项目。
In Android Studio:
在 Android Studio 中:
File -> Settings -> Inspections
Under Android Lint, locate Using system app permission. Either uncheck the checkbox or choose a Severity lower than Error.
在 Android Lint 下,找到使用系统应用权限。取消选中该复选框或选择低于错误的严重性。