29

Unable to run apk on nexus 5 after upgrading to 5.1.1

Using Cordova: 5.0.0 Device : Nexus 5 Machine : MAC

BUILD SUCCESSFUL

Total time: 8.432 secs
Built the following apk(s):
    /Applications/XAMPP/xamppfiles/htdocs/android/kaljacobs/platforms/android/build/outputs/apk/android-debug.apk
Using apk: /Applications/XAMPP/xamppfiles/htdocs/android/kaljacobs/platforms/android/build/outputs/apk/android-debug.apk
Installing app on device...

/Applications/XAMPP/xamppfiles/htdocs/android/kaljacobs/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
ERROR: Failed to launch application on device: ERROR: Failed to install apk to device:  pkg: /data/local/tmp/android-debug.apk
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]

ERROR running one or more of the platforms: Error: /Applications/XAMPP/xamppfiles/htdocs/android/kaljacobs/platforms/android/cordova/run: Command failed with exit code 8
You may not have the required environment or OS to run this project
Jijesh
  • 327
  • 1
  • 4
  • 10
  • change api level 21 to 22, i don't know what is used to change this in Cordova – Dhaval Parmar May 28 '15 at 09:27
  • @DhawalSodhaParmar i already updated to Android 5.1.1 API 22 in Android SDK Manager – Jijesh May 28 '15 at 10:03
  • i see this line in your question : "You may not have the required environment or OS to run this project", i think you have to update you Cordova API or SDK (whatever) or first check Cordova support android 5.1.1??? also check this answer: http://stackoverflow.com/q/29721410/1168654 – Dhaval Parmar May 28 '15 at 10:09
  • "You may not have the required environment or OS to run this project" is just a generic message when something goes wrong. (I think cordova devs put this message because most of building issues are caused by sdk not installed or not configured properly) – QuickFix May 28 '15 at 13:26

2 Answers2

84

I think you have this issue because the app is installed on your device with a different signature.

When you do cordova run android, the app is installed with a debug signature and maybe that signature changed when you changed target sdk or when you upgraded android.

The fix when you have INSTALL_FAILED_UPDATE_INCOMPATIBLE error is to first uninstall your app and then you should not have the issue any-more when launching cordova run android

QuickFix
  • 11,661
  • 2
  • 38
  • 50
  • The debug package installed on device could has been generated from different computer, so different signature. – Rafael Leonhardt Oct 20 '16 at 19:46
  • That was exactly the issue I was facing. I had a previous version of the app which was installed while I was debugging from another computer. When I tried to debug the same project on a new computer, the build wasn't sucessful. I simply uninstalled the app from my Android and installed the app again using visual studio (F5). – Bartho Bernsmann Mar 03 '17 at 09:29
4

Don't worry about that.for NEXUS 5.go to Settings>> apps>> search application.

enter image description here

enter image description here enter image description here

Well done..

Saw Pyae
  • 269
  • 4
  • 9