1

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?

gonzobrains
  • 7,856
  • 14
  • 81
  • 132
  • 2
    which permission you are trying to add?? – Akram May 09 '13 at 08:41
  • 1
    Post AndroidManifest.xml here – Manish Dubey May 09 '13 at 08:42
  • @gonzobrains - please revisit this question as the answer you had selected is mistaken as to the real issue – Chris Stratton May 13 '13 at 20:13
  • The "real" issue (for me anyways) is why Eclipse is giving me grief over this now but never bothered to before. I realize the underlying cause is that these permissions are not allowed. In fact, they were being disallowed during program execution well before Eclipse suddenly starting "breaking" over this. I'm just happy to have learned I can ignore Eclipse using the solution offered by @ling.s. – gonzobrains May 13 '13 at 23:07

2 Answers2

2

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.

Linga
  • 10,379
  • 10
  • 52
  • 104
  • Why am I getting this problem though? – gonzobrains May 09 '13 at 17:30
  • That allows me to build but the problem is still there. Why was I allowed to compile this before error-free but modifiying the manifest causes the errors to show up? – gonzobrains May 09 '13 at 17:35
  • This is not really an answer to the fundamental problem, which is that those permission **are not available to 3rd party apps, period**. Changes in warning level won't change that fact. – Chris Stratton May 13 '13 at 20:11
  • @ChrisStratton I have determined via logcat that, previously, the permissions were simply being denied even though the app would build and execute. What I am trying to discover, however, is why Eclipse just started now to report this as an error. I have seen other questions on SO where people have discussed similar findings. I understand the permissions are not available; I'm just trying to figure out why Eclipse allowed them before but not now. – gonzobrains May 13 '13 at 23:03
  • 1
    @gonzobrains - because the android tools (and also, for some other issues, runtime) have gotten steadily more particular at combating folklore and protecting novice developers from continuing bad habits. A number of members of Google's Android team read things here from time to time, occasionally answer questions, and doubtless roll their eyes over many more. Declaring those permissions never worked, the fact that the tools now call it an error is more a mechanism for education than a functional change. – Chris Stratton May 29 '13 at 02:22
  • @ChrisStratton Makes sense to me! – gonzobrains May 29 '13 at 16:54
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.

mobidev7
  • 61
  • 1
  • 3
  • Yes, but the project was compiling with these permissions before so I don't know why the problem would show up just because I modify the manifest file. – gonzobrains May 09 '13 at 17:31
  • Perhaps you updated to a newer, smarter version of the SDK or ADT? Or perhaps you changed your target SDK version? – Edward Falk May 13 '13 at 19:22
  • **this is the correct answer** - what was or was not generating an advisory warning in which version is comparatively irrelevant. – Chris Stratton May 13 '13 at 20:12