138

In my emulator, when I try to do an upgrade of my apk programmatically. I get:

Android App Not Install.

An existing package by the same name with a conflicting signature is already installed

enter image description here

I'm still in the testing phase of this upgrade, so the file I download is a signed apk of a previous version, which I think should work without any issues.

From the suggestion in: an existing package by the same name with a confilcting signature is already installed I tried to run the emulator both in debug mode and in normal mode... neither worked.

Any thoughts on what I'm missing?

Community
  • 1
  • 1
James Oravec
  • 19,579
  • 27
  • 94
  • 160
  • 1
    use same signature to sign the apk before install – Praveen Sharma Nov 13 '13 at 17:08
  • 1
    This issue generates due to signature or Key-store file mismatch find the link for the solution: https://readyandroid.wordpress.com/app-not-installedthe-package-conflicts-with-an-existing-package-by-the-same-name-android/ – Ready Android May 02 '18 at 14:12

15 Answers15

200

I had the same error message, but these answers did not help. On a 4.3 nexus 7, I was using a user who was NOT the owner. I had uninstalled the older version but I kept getting the same message.

Solution: I had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'

async
  • 1,537
  • 11
  • 28
agelbess
  • 4,249
  • 3
  • 20
  • 21
  • 2
    I had to swipe over from "Downloaded" to the "All" list to find it in the Apps list. – ShawnFeatherly Feb 03 '14 at 20:49
  • 2
    As you mention, make sure you scroll all the way down to the bottom - the "not installed" apps are *not* listed in alphabetical order. – jmcmann Mar 20 '14 at 16:22
  • 3
    THANK YOU!!! This was also my problem after lending my test Nexus 7 to a friend. Thought my keys were corrupted... I deleted that user just to reduce future confusion. – mm2001 Jun 14 '14 at 23:46
  • 1
    Saved my time. Kudos. – Piyush Patel Jan 08 '15 at 11:08
  • 2
    Thanks. I had to login in all users and uninstall 1 by 1. – Ricardo Jan 28 '15 at 15:37
  • 1
    This is the perfect answer. Better than the "marked as correct" one. Thanks a lot. – Aritra Roy Feb 12 '15 at 20:37
  • It is a strange thing that this is happening. Hm. But thanks for the solution, worked indeed :) – Alexey Mar 02 '15 at 15:04
  • Thank you so much! I think this is a problem when you have multiple profiles setup for the android device. – marcwjj Apr 14 '15 at 18:27
  • I logged in to a public computer just to upvote this answer – SKT Dec 31 '15 at 09:40
  • I am unable to uninstall using this method, showing "not installed" but not leaving itself from list :( – Vivek Warde Feb 19 '16 at 12:27
  • Thank you! The solution is not intuitive and you saved me a bunch of time! – zdp Apr 28 '16 at 14:18
  • Thanks so much!! I was logging in from the "owner" and uninstalling. But it was still showing the error. Then I realized, there was a guest account!! I had to uninstall from there too!! – Kaustav Banerjee Nov 10 '16 at 19:52
  • I have an application in LIVE in playstore, now I kept installed that app in testing device and now For updating newer version of app I'm updating "versionno" and "versionname" in app build.gradle file. Now I have made an release build with signed key, now while im trying to install that build in it through an error ::: An existing pacakage by the same name with a conflicting signature is already installed . And not getting installed too . Kindly help . – Tarit Ray Apr 19 '19 at 12:49
108

The problem is the keys that have been used to sign the APKs, by default if you are running directly from your IDE and opening your Emulator, the APK installed in the Emulator is signed with your debug-key(usually installed in ~/.android/debug.keystore), so if the previous APK was signed with a different key other than the one you are currently using you will always get the signatures conflict, in order to fix it, make sure you are using the very same key to sign both APKs, even if the previous APK was signed with a debug-key from another SDK, the keys will definitely be different.

Also if you don't know exactly what key was used before to sign the apk and yet you want to install the new version of your app, you can just uninstall the previous application and reinstall the new one.

starball
  • 20,030
  • 7
  • 43
  • 238
Martin Cazares
  • 13,637
  • 10
  • 47
  • 54
  • I'm going to do a non dev sign the apk and do a manual download/install inside the emulator. The emulator should then download the other non dev signed apk and try to do the upgrade. If this works, I'll accept your answer. Thx – James Oravec Nov 13 '13 at 17:22
  • 1
    @MartinCazares is there anyway to get the apk key? so I don't lose my app data? – heisenberg Jan 21 '15 at 11:05
  • Well, if you installed the app, you should have the key, otherway how would you sign the apk? If the previous apk was not created by you, then you need to ask to the developer of that apk for the key, other than that there's no way to get the key that was used to sign an apk... – Martin Cazares Jan 21 '15 at 17:25
  • 1
    I have an application in LIVE in playstore, now I kept installed that app in testing device and now For updating newer version of app I'm updating "versionno" and "versionname" in app build.gradle file. Now I have made an release build with signed key, now while im trying to install that build in it through an error ::: An existing pacakage by the same name with a conflicting signature is already installed . And not getting installed too . Kindly help . – Tarit Ray Apr 19 '19 at 12:52
9
 Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.

enter image description here

Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.

Keshav Gera
  • 10,807
  • 1
  • 75
  • 53
7

If you are using the debug apk, the key that is used to sign it is in

C:\Users\<user>\.android\debug.keystore

If you use that same key, there should not be a conflict when installing.

Santiago
  • 719
  • 7
  • 11
  • 1
    Thanks alot Santiago,last day i changed my machine hard drive from mechanical drive to the Solid State drive therefore i need to upgrade my Windows,i was facing the same issue then i copied the debug.keystore file from the previous windows folder to the new windows folder the issue gets resolved :) – Arslan Sohail Jun 01 '16 at 07:04
  • Thanks for the answer, because it actualy solved my problem, I am programming with a friend and we had this problem frequently, now that we are sharing the debug key, everything is fine. – Gustavo Magalhães Aug 18 '17 at 19:14
6

If you don't want to bother with the keystore file, then just remove the package altogether for all users.

Connect your device with Mac/PC and run adb uninstall <package>

Worked for me.

Ref: https://android.stackexchange.com/questions/92025/how-to-completely-uninstall-an-app-on-android-lollipop

Community
  • 1
  • 1
Avijit
  • 1,253
  • 13
  • 21
6

If above solutions did not work for you then you may have doing something as following ..

1) installing the app from Appstore.
2) updating it with sign APK with same package name updated version.

So basically there are two kinds if APK's.

1) you uploaded on playstore known as original APK.
2) download from playstore known as derived APK.

In this case basically you are downloading derived apk and updating it with original APK.

For let it work fine uploaded new signed released APK in the internal test mode on the Google Play Store and download the derived APK to check the update scenario.

enter image description here

Wahab Khan Jadon
  • 875
  • 13
  • 21
5

There is a difference between signed and unsigned APK files. Most likely you had an unsigned on there previously. You just need to delete the unsigned before you install the signed version. How this can be accomplished varies on the exact version, but in general, go on the emulator to settings-> application, long click your app, and delete/remove/uninstall it.

PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142
  • I'll make an unsigned apk and download the unsigned apk and see if that solves it, if it does then I can test the signed apks with hardware. I'll accept the answer if this is the case. – James Oravec Nov 13 '13 at 17:06
  • I'm trying to do the upgrade from within my program, so doing the manual uninstall/install won't work. – James Oravec Nov 13 '13 at 17:07
  • When I did the unsigned app install I simply get `app not installed`. I checked the emulator settings and it has `Allow installation of apps from unknown sources` checked. So this does not seem to be the solution. – James Oravec Nov 13 '13 at 17:17
  • giving you an up vote for the suggestions. I think it helped us get to the final solution. thanks! – James Oravec Nov 13 '13 at 17:29
3

If you use multiple users at android, verify that the app is uninstalled everywhere.

Martin Koubek
  • 433
  • 4
  • 8
2

It may be application is not uninstall successful. If your device is this case, you can try this method.

First get the package name of the application, e.g 'com.xxx.app', you can use Root Explorer and find it from Manifest file(RE can decode the file). then you can use this script to uninstall it:

adb shell pm uninstall com.xxx.app // replace to package name that you want to remove
twiceYuan
  • 863
  • 8
  • 11
1

I had an issue where both debug and release build won't install on devices I used for debugging. The same msg would appear when trying to install the new version. The only workaround was to uninstall the current version and install the new one.

It looks like Android studio marks the apk it installs so that installation using the package managers would distinguish between version installed for debugging and versions downloaded from Google play or other external sources (this never happened to me when using eclipse).

FunkSoulBrother
  • 2,057
  • 18
  • 27
1

There may be another reason when your application will not update when you either change/add/remove shareId in AndroidManifiest.

"android:sharedUserId"

Please check that also.

To prevent would recommend to use sharedUserId in your application despite in your current requirement you need or now.

Pawan Maheshwari
  • 15,088
  • 1
  • 48
  • 50
1

Same package error:

  1. Create a new Package in your app with different name.
  2. Copy and paste all file in your old package to new Package.
  3. Save Code.
  4. Delete old Package And Clean and rebuild project.
VIJAY RAVAL
  • 138
  • 1
  • 8
1

enter image description hereI had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'

  • That worked for me, but...now when download from my website, the app does not download (at least to the Download folder). No errors reported. Just doesn't happen. When I plug my phone into my computer I can copy the APK to the phone and install with no errors reported. – Ron Mar 13 '19 at 13:49
1

I tried all the above and it did not work.

I found that in spite of uninstalling the app a new version of the app still gives the same error.

This is what solved it: go to Settings -> General -> application Manager -> choose your app -> click on the three dots on the top -> uninstall for all users

Once you do this, now it is actually uninstalled and will now allow your new version to install.

Hope this helps.

-1

I just choose uninstallAll in Gradle Bar. It worked for me.

enter image description here

Khay Leng
  • 391
  • 5
  • 8