Unknown error code during application install "-505"

With an official Lollipop version and for mac users (i'm sure it's analogue to windows users):

  • Go to the terminal,
  • cd into: ADT/sdk/platform-tools
  • type ./adb uninstall the.app.package

and thats it!

  • you just uninstalled the app
  • don't add the -k flag - ('-k' means keep the data and cache directories)

good luck!


This seems stupid on my part, yet finally found the answer which seems to be the fact that I had another dev app(diff package name) which had a common signed permission with the playstore app. Buried deep in my logcat was this.

11-21 16:20:02.855: E/Finsky(8986): [1] PackageInstallerImpl.handleCommitCallback: Error -505
while installing <package>: INSTALL_FAILED_DUPLICATE_PERMISSION: Package <package> attempting to
redeclare permission <package>.permission.MAPS_RECEIVE already owned by 

beginning with lollipop it seems this isn't permitted. Thanks to everyone.

EDIT

The solution if not apparent yet is to change the permission from

 <permission android:name="<old package>.permission.MAPS_RECEIVE"
 android:protectionLevel="signature" />

to

<permission android:name="<new package>.permission.MAPS_RECEIVE" 
android:protectionLevel="signature" />

or whichever signed permission that is causing the same.


If the app you are trying to install has the same certificate as a similar app or related app with the SAME certificate, then Android 5.0 won't allow the installation, believing you are installing a duplicate of the already installed (but different) app. Only solution that worked for me? Uninstall the app with the same certificate, which would be an app made by same developer that made the app you are trying to install. Once you've uninstalled that app, install the problematic app, then go back and reinstall the other app which was already installed. This problem happened to me only once, when trying to install the FB Messenger app. I finally was able to install it after I uninstalled the Facebook app. Then I reinstalled Facebook after Messenger was installed. OK, good luck to all and hope this helps some of you.


This is caused by a bug with app certificate parsing in Lollipop:

https://code.google.com/p/android/issues/detail?id=79089