Android manifest file breaks after adding a permission

你离开我真会死。 提交于 2019-12-19 10:46:21

问题


I have a really strange problem with an Android project I inherited. I tried adding a permission to it and suddenly a few other permissions break with the red "X" being displayed along with this error:

"Permission is only granted to system apps."

How could this be if all I did was add a permission? If I don't save the manifest and clean the project, all the red "X" marks go away and it compiles again. Why is this happening?


回答1:


In Eclipse, goto

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.




回答2:


There are some permissions (e.g., MODIFY_PHONE_STATE) which can be granted only to applications which have been signed with system's certificate. So if you trying to add one of those permission, then Lint will raise a red flag while compiling application's manifest file.



来源:https://stackoverflow.com/questions/16457720/android-manifest-file-breaks-after-adding-a-permission

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!