Cannot upgrade old application by android studio generated apk file in Lollipop
Asked Answered
C

2

2

I was installed old version(version 1) of my application from google play store in my phones. Now I would like to update this app to new version(version 2), so, I generated new apk file by using android studio and I upload this generated apk to google drive. Then download and install from my several devices(Android 5.1.1, and Android 4.2.2).

In android 4.2.2, I can install the downloaded apk and my application was upgraded to version 2 successfully.

In Android 5.1.1, I can click on install button, after that show the "App not installed" error message and the application was not upgraded to new version(version 2).

Could you please give me some advice?

Please see the attachment picture of android 5.1.1 device.

enter image description here enter image description here

Cubit answered 26/11, 2015 at 3:43 Comment(5)
Switch to guest user and try uninstalling the app. Then switch back and try installing..Refreshment
Did you mean uninstall the old app first and then install the new apk file? This is ok for me but I want to upgrade the app without uninstalling the old app in phone because app uninstall will be delete all app data. ThanksCubit
Probably there was an app with the same package name which was signed with different certificate. Otherwise it can't happen.Janice
Did you upgrade your device to Android OS to 5.1.1(using update) or was it out from factory with 5.1.1?Refreshment
Make sure that you sign your application(version 2) with the same keystore you used to sign your old application(version 1), or uninstall first from the device your old application(version 1) before you install your upgraded application(version 2)Cohin
R
2

I think it is bug. It happened to me once while upgrading to a new version. The problem occurs when there are 2 users in Android OS(i.e. Settings>Users. Probably in your case, guest user must be present). So when app was previously installed, it must be installed for both primary and guest user. So when Android OS tries to uninstall the app to upgrade, it only uninstalls app for primary user and not for guest user. So the app is still present in the OS but not for primary user preventing installation of the new app. At least this is what I think it is.(I am using a Moto G)

But I have never encountered this bug when upgrading from playstore. It only happened when trying to upgrade app by installing apk from external source. I hope it helps...

Refreshment answered 26/11, 2015 at 4:22 Comment(3)
So, it will not happen when I upload the app on playstore? :) ThanksCubit
Fabin, when I generate apk from eclipse and install it in android 5.1.1, this can successfully upgrade the installed app in phone. So, this means it is not related to the multiple users account issue. BTW, I cannot find Setting/Users in my phone. my phone is Samsaung Galaxy S6 edge. Thanks.Cubit
Samsung for some reason doesn't support multiple users feature in lollipop.reference. So that means multiple users is not causing the problem. While installing apk, check logcat for message "attempting to redeclare permission". It is a known bug for lollipop.referenceRefreshment
C
0

When you upgrade your application and build for release, make sure that you sign your application with the same keystore you used to sign your previous application version.

When you use new keystore to sign your new application version and attempts to install it into the device with your application(old version) already installed, android will halt the installation and you can tell exactly why it does not install by looking at the logcat.

Cohin answered 26/11, 2015 at 4:50 Comment(1)
I used the same keystore, so, I can install this same apk on android 4.2.2. But in android 5.1.1 it doesn't allow me to install when there has old application is installed in the phone. ThanksCubit

© 2022 - 2024 — McMap. All rights reserved.