Permission is only granted to system app

2019-01-03 01:50发布

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.

6条回答
Viruses.
2楼-- · 2019-01-03 02:04

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.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-03 02:11

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

查看更多
Ridiculous、
4楼-- · 2019-01-03 02:24

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.

查看更多
做个烂人
5楼-- · 2019-01-03 02:24

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"
查看更多
Emotional °昔
6楼-- · 2019-01-03 02:24

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

查看更多
够拽才男人
7楼-- · 2019-01-03 02:27
tools:ignore="ProtectedPermissions"

Try adding this attribute to that permission.

查看更多
登录 后发表回答