Unknown error code during application install "-505"

25,621

Solution 1

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.

Solution 2

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!

Solution 3

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

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

Solution 4

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.

Solution 5

Multiple users installing same app on same device may cause this error. Please remove other app from the device and that should work.

I faced similar issue, however in my case it was an old development build sitting on my device and when I was trying to install from play store this error was coming.

Share:
25,621
humblerookie
Author by

humblerookie

Most of my answers are just guesses, be wary. Android development pays for my sandwiches.

Updated on July 09, 2022

Comments

  • humblerookie
    humblerookie almost 2 years

    I have checked this android 5.0 lollipop app install shows Unknown error code during application install: "-505". But it doesn't seem to address my case as I dont use multiuser env.

    I have an app in the playstore which worked fine on my nexus 4(4.4.x) till i upgraded to lollipop and it showed this error every time i tried to install it from playstore(It installs fine if I run it via adb).

    Can't understand why I might be facing this issue, neither is there any other reference to this error code. Any help is appreciated.

  • humblerookie
    humblerookie over 9 years
    This doesn't solve my problem much less even fall under the domain of my question.Ive completely uninstalled the app since i didn't choose to back my data, besides as I clearly mentioned the problem is with the playstore install and not my adb install
  • nitzanwe
    nitzanwe over 9 years
    I had your problem when I tried to install the app I'm developing from the playstore (so plz remove the down vote...), even after uninstalling it from my device. after I deleted all residue from my eclipse sourced version with what I have done above, the install went fine.
  • marmor
    marmor over 9 years
    This is definitely the correct solution to the issue, I've downloaded the app from Google Play after uninstalling it, and got this error. This solution definitely worked for me. Thanks!!!!11
  • humblerookie
    humblerookie over 9 years
    @nitzanwe :This solution would have worked for the scenario I had provided a link for but it seems Its something more specific.@marmor It isn't the solution.
  • humblerookie
    humblerookie over 9 years
    I've cross validated the hashes and they seem to be the same,The original issue is code.google.com/p/android/issues/detail?id=79375.But a upvote seems legit for the right direction :)
  • humblerookie
    humblerookie over 9 years
    found the root cause which wasn't evident earlier and was buried in my logcat, seemed surprisingly simple.
  • Deb
    Deb over 9 years
    Hi Humblerookie, How did you get this in your log cat. Coz i tried to install my two applications which were giving me this error on a lollipop from adb , it just installed without this error but when i tried it from google play it did.
  • humblerookie
    humblerookie over 9 years
    I examined the device's logcat while the installation happened from google play. Not sure why you wouldnt be able to see the trace for the same.Anyways beginning lollipop there are other reasons responsible for this error like a certificate parsing bug as highlighted rightly by @jj1138
  • Deb
    Deb over 9 years
    Thnx, found the error. Some custom permissions with the same package structure was creating problem.
  • Nitin
    Nitin over 9 years
    Hi @humblerookie can you please give me solution how can i resolve it . should i change the package name or any thing else
  • humblerookie
    humblerookie over 9 years
    Incase the error is arising due to a duplicate permission the you need to rename the permission to reflect your current package specific permission i.e for the scenario above it would be <new-package>.permission.MAPS_RECIEVE
  • Nitin
    Nitin over 9 years
    <permission android:name="com.example.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /> can this permission cause the error
  • humblerookie
    humblerookie over 9 years
    yes if you have another app that contains the same permission, rename this to <yourapppackage>.permission.C2D_MESSAGE
  • Nitin
    Nitin over 9 years
    Thank you so much :) +1 I think you should append this conversation to your answer in order to improve this answer
  • Programmer
    Programmer almost 9 years
    @Nitin I have same problem with C2D_MESSAGE permission. There are two permissions tags 1) <permission ...C2D_MESSAGE> and 2) <uses-permission ..C2D_MESSAGE> . So do I have to replace com.example.gcm with my_package_name in both tags? Please reply soon. Thanks.
  • Nitin
    Nitin almost 9 years
    yes you have change the two of them . You can up vote my any answer for reward :)