Reputation: 17429
I was modyfing my android app, and I was trying it on real device (Run Application in eclipse) and all was working good. So When I was satisfied of my changes, I opened the Manifest in order to modify the version for releasing it, but WITHOUT ANY CHANGES in Manifest an error occurred at line:
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
the error is:
Permission is only granted to system apps
How is this possible? I builded my application many times using this line.
Upvotes: 7
Views: 6983
Reputation: 4297
Cleaning will work if you have already changed in your lint preferences. Else check the below solution.
Permission is only granted to system app
It says to change your Lint Settings
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 -> Inspections
Under Android Lint
, locate Using system app permission
. Either uncheck the checkbox or choose a Severity lower than Error.
Upvotes: 2
Reputation: 17429
Thanks to all. I solved the strange problem with
Project > Clean
Now all works good again!
Upvotes: 18
Reputation: 23498
you may not install packages yourself, don't even ask about that.
use Intent
for that purpose:
Intent installIntent = new Intent(Intent.ACTION_VIEW );
installIntent.setDataAndType(
Uri.parse("file://" + context.getFilesDir().getAbsolutePath() + "/" + file_name_to_install),
"application/vnd.android.package-archive");
startActivity(installIntent);
if you were using Eclipse, most probably it has used old/outdated version of your Manifest, and when you open it, the changes were reloaded and brought up the error message. just remove offending permission and use Intents.
Upvotes: 2