7

I've an app in Play Store.

Now, I need to update that with an updated version. Before, pushing it to Playstore, I thought I'll check the migration with APK.

I installed existing version from Playstore. Now, I'm trying to install the latest (signed) apk. But it says, App cannot be installed.

This exact case is working with Playstore. I tried with Beta distribution. It worked correctly.

Am I missing something..?

Thanks in advance

Rino
  • 1,215
  • 1
  • 16
  • 28
  • 1
    yeah it will not install you need to uninstall the existing application first and still you want install both application existing and new version you have to change your pacakge name . – Bunny Feb 20 '18 at 10:23
  • But, I want to test the update (DB migration). Need to test it in the real time. Any other way...? @Bunny – Vignesh Thillai Feb 20 '18 at 10:28
  • no other way you have to uninstall existing apk then you can install the latest (signed) apk .You can not migrate apk like that – Bunny Feb 20 '18 at 10:30

4 Answers4

2

This is almost certainly because of signature keys. Android only allows an upgrade (instead of uninstall/reinstall) if the upgrade is signed with exactly the same signature as the original install.

If you sign the app yourself, then make sure the signature key matches the Play store version before trying the install - if you use your debug/development signing key signed APK it won't work.

If your App is enrolled in Google Play signing then this won't be possible. The best option for testing in this case is to use the Alpha track. Set yourself as the only Alpha user, and release the APK you want to test on the Alpha channel. Google will sign it for you, and deliver the update. You can then use this to test your DB update.

The other option you can do is install the old version of the app yourself (not from Google Play, signed with your debug key), then try the update, again, signed with your debug key. But whatever you do, updates only work if the APK update is signed with the same key as the original installed APK.

Nick Fortescue
  • 13,530
  • 1
  • 31
  • 37
  • Thanks for the answer @Nick Fortescue! I'm sure that the signature keys are same. (I've compile the signed apk with the same .keystore file). That's why I'm more confused... – Vignesh Thillai Feb 21 '18 at 05:43
  • You might be sure, but have you double checked? I've seen lots of developers think they know what they are doing with signatures and get it wrong. There are a lot of ways here: https://stackoverflow.com/questions/17423870/is-there-any-way-to-get-key-hash-from-signed-apk of getting your certificate hash. Get them from both the installed APK and the APK you are trying to install, and check they match. – Nick Fortescue Feb 22 '18 at 08:18
  • Thank you @Nick Fortescue! I'll check the hash values of the apks. – Vignesh Thillai Feb 23 '18 at 07:48
0

I have faced the same problem. Easiest way to test version migration, is uninstall the play store version, install old apk, (login, update datas etc), and then finally install the newest apk.

So be sure that you keep old versions of your application somewhere.

user3777939
  • 381
  • 2
  • 12
-1

First of all uninstall the current app from device and follow the below steps :

  1. Go to Settings
  2. Go to Apps
  3. Now scroll down to your app and tap on your app.
  4. On the upper left corner tap on Overloaded menu (3 vertical dots).
  5. Tap on Uninstall for all users.

Now install the new app.

Pranay Soni
  • 403
  • 3
  • 12
-1

The easiest way to do this is to use the following ADB command:

adb shell pm uninstall <package name>

I have tried it and it works. After executing this command, try installing from playstore, you will be able to install