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

耗尽温柔 提交于 2019-12-11 00:15:22

问题


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.


回答1:


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...




回答2:


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.



来源:https://stackoverflow.com/questions/33930223/cannot-upgrade-old-application-by-android-studio-generated-apk-file-in-lollipop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!