Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission is only granted to system app

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.

like image 259
Caner Avatar asked Dec 10 '12 13:12

Caner


People also ask

How do I give an app full permissions?

From the Settings screen, you can head to Settings > Apps > Apps & Features, click an app, and click “Advanced Options.” Scroll down, and you'll see the permissions the app can use under “App Permissions.” Toggle the app permissions on or off to allow or disallow access.

Which permission is automatically granted by Android system?

Android apps must request permission to access sensitive user data (such as contacts and SMS), as well as certain system features (such as camera and internet). Depending on the feature, the system might grant the permission automatically or might prompt the user to approve the request.

Can I change app permissions on Android?

To change an app's permission, tap the app, then choose your permission settings.


2 Answers

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.

like image 62
Ole Avatar answered Sep 28 '22 09:09

Ole


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" 
like image 44
Jesta Avatar answered Sep 28 '22 08:09

Jesta