Permission is only granted to system app

AndroidEclipseLint

Android Problem Overview


I have a System app that uses system permissions and I have those permissions listed in the manifest. Eclipse gives the following error when I try to make a build(command line build works):

> Permission is only granted to system apps

I'm already aware that my app requires system permissions and it is not a problem for me because my application will be used only on rooted phones. So I want to suppress this error, anyone knows how?

EDIT
My project already compiles fine on command line, installs, runs etc.. My problem is about eclipse giving an error for a legit manifest file.

Android Solutions


Solution 1 - Android

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.

In Android Studio:

> File -> Settings -> Editor -> Inspections

Under Android Lint, locate Using system app permission. Either uncheck the checkbox or choose a Severity lower than Error.

Solution 2 - Android

To ignore this error for one instance only, add the tools:ignore="ProtectedPermissions" attribute to your permission declaration. Here is an example:

<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
    tools:ignore="ProtectedPermissions" />

You have to add tools namespace in the manifest root element

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"

Solution 3 - Android

Have same error from time to time (when I set install location to "prefer external" in manifest). Just clean and rebuild project. Works for me.

Solution 4 - Android

tools:ignore="ProtectedPermissions"

Try adding this attribute to that permission.

Solution 5 - Android

Path In Android Studio in mac:

Android Studio -> Preferences -> Editor -> Inspections

Expand Android -> Expand Lint -> Expand Correctness

Uncheck the checkbox for Using system app permission

Click on "APPLY" -> "OK"

Solution 6 - Android

when your add permission in manifest then in eclipse go to project and clic

  1. click on project
  2. click on clean project that's all

k on clean project

Solution 7 - Android

Preferences --> EditorEditor --> Inspections --> Android Lint --> uncheck item Using System app permissio

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCanerView Question on Stackoverflow
Solution 1 - AndroidOleView Answer on Stackoverflow
Solution 2 - AndroidJestaView Answer on Stackoverflow
Solution 3 - AndroidAmaliaView Answer on Stackoverflow
Solution 4 - Androiduser10206860View Answer on Stackoverflow
Solution 5 - AndroidKarishma ChaudharyView Answer on Stackoverflow
Solution 6 - AndroidAdiiiView Answer on Stackoverflow
Solution 7 - AndroidVăn VũView Answer on Stackoverflow