1

I want to run my application in phone but I get following message:

Installation failed with message:

INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package signatures do not match the previously installed version; ignoring!.

It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing. WARNING: Uninstalling will remove the application data! Do you want to uninstall the existing application?

In my phone I have installed previous version of app from google play. I know that uninstalling old version of app from my phone can fix the problem but I don't want to do this because then I might lose all app specific data.

What I tried:

  • generating signed version of app using the same keystore.jks like previously
  • changing versionCode and versionName in build.grandle file and then generating new version of app

And still I have the same problem. What should I do to update my app without losing data?

Community
  • 1
  • 1
luqiasz
  • 203
  • 3
  • 9
  • https://stackoverflow.com/q/31489567/1531971 https://stackoverflow.com/q/49757862/1531971 among others. –  Jul 10 '18 at 19:21
  • I already saw this threads and this can fix my problem but like I said I don't want to uninstall my old app because I loose data – luqiasz Jul 10 '18 at 19:46
  • You should show the ADB command you are running. That is, did you try `adb -r ...`? –  Jul 10 '18 at 19:56

3 Answers3

3

There are two possibilities I can think of

  1. You use Google Play App Signing. If you use Google Play App Signing then the signature in apps coming from Google Play will always be different to the app coming from your IDE. The only way you can get the update to work is to update the app from Google Play. The best way to do this during development is to use an "Internal test track". Google launched these at Google I/O this year and they let you update your app in seconds from Google Play. So when you have an update, don't install from your IDE, upload to Google Play internal test track, republish, and then update from Google Play. It is really quick.
  2. You don't use Google Play App Signing, but you are trying to install your debug build instead of your release/production build. Make sure you are building the production release APK, so it is signed with the same key as the one uploaded to Google Play.
Nick Fortescue
  • 13,530
  • 1
  • 31
  • 37
0

If I'm understanding correctly you want to re install the "same" apk in your phone but with some changes in the code (updates) but Android Studio can't install the new apk.

I can only think in one thing, this is the explanation:

Please remember that android has different "Build Variants" there could be many but you will always have "debug" and "production" build variants, as I can read, you have installed the one in Play Store this means that you have a "production" build variant already installed in your phone, so you need a new "production" variant version of your app with the same build data (code and name version) and the updates in the code.

Build a signed apk with the same data as the previous version (code and name version) (Just like the one you used to upload to Play Store).

Find the signed apk. Use adb to check your connected devices, expect a list

adb devices

Use adb to install this new apk.

adb -s <device_identifier> install <apk_name_include_apk>

Following those steps should let you install what you need.

vicco
  • 181
  • 2
  • 7
  • I get the same error: adb: failed to install release.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package signatures do not match the previously installed version; ignoring!] – luqiasz Jul 10 '18 at 19:16
0

Go in your React Native > Android >app in the app folder, you can see a build just delete this folder and Clear React Native project by npm cache clean cmd/Terminal Command.

Now try to run I hope it will Run for some of you. It's working for me.

Hemant Sharma
  • 259
  • 5
  • 14