3

I successfully produced a small private android app (using appcelerator if that makes a difference) and installed it on my device from the signed apk file.

I then made some changes to my application and repackaged it with an updated version number but signed with the same certificate and that when I ran into my problem.

When I try to install this on my android device, as expected it warns me that "The application you are installing will replace another application" but "All previous application data will be saved". I agree to the replacement and the install goes ahead with out an error until it gets the and says "Application not installed", without any other details.

The version code and name in the original apk are:

android:versionCode="1" android:versionName="1.0"

and in the second version

android:versionCode="2" android:versionName="1.1"

I am being driven mad by this, what am I missing?

Finglish
  • 9,692
  • 14
  • 70
  • 114
  • 1
    are your app-versions signed with the same key? – stefan Dec 15 '11 at 23:24
  • Redo all your actions with your device connected to DDMS, see if you can get a detailed stack trace than "Application not installed" from Logcat. – yorkw Dec 15 '11 at 23:50
  • It is most likely that somehow they are signed with different keys. This is the exact behavior that it has on most devices in this scenario. – FoamyGuy Dec 16 '11 at 01:06

5 Answers5

6

First, try installing you application using adb:

adb install -r /path/to/your.apk

If that does not help, try:

adb shell pm uninstall -k com.your.package
adb install /path/to/your.apk

This uninstall the apk, while keeping all its data. And then reinstalls it once again. If this also doesn't help, adb will at least give you error code which is much easier to troubleshoot with.

inazaruk
  • 74,247
  • 24
  • 188
  • 156
  • Not sure why but installing the first package via adb again did the trick, now the new versions install correctly over the top of the original – Finglish Dec 16 '11 at 04:56
2

While the OP has already mentioned they were setting android:versionCode higher than the previous build, and so this answer won't solve their specific problem, I have found in my case the answer was to increase android:versionCode to be higher than the installed version. Only figured this out after finding this question/

DanH
  • 5,498
  • 4
  • 49
  • 72
2

if the key signing is different then you can have that problem

CQM
  • 42,592
  • 75
  • 224
  • 366
0

You suppose to check your logic with the same key signing with release apk

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=your_package_name &hl=en"))); 

it will show update button on play store.

Sushant Patekar
  • 421
  • 1
  • 5
  • 17
0

Sometimes old build files get reused. You can save the following script:

(1) Add the following script to your package.json:

{
    ...
    "scripts": {
        ...
        "android-install": "npm run android-clean && npm run android-bundle && npm run android-assemble-release && npm run android-uninstall-release && npm run android-adb-install"
    }
} 

(2) Each time you want to install to your Android device, just run:

npm run android-install

The above script fails if you have no Android device attached. If you want to simply assemble a release without installing the application onto a device, simply remove the last two commands (&& npm run android-uninstall-release && npm run android-adb-install)

RavenMan
  • 1,807
  • 1
  • 15
  • 27