How to keep two version of an android application in the same device

北城余情 提交于 2019-12-12 06:18:32

问题


Whenever I try to install the 2nd version, it says that it is going to replace all data from the previous version. I did the following things to avoid such situations:

  1. app names are different so .apk file name is also different
  2. package names are different

My app has a database. Do I need to have different database name for these two version ?

So, I would like to know, what I am doing wrong and what more should be done? I am using eclipse simulator at the moment.


回答1:


You must have a different package name, there is no other way. I had 2 different versions of the same product (free & paid) and used: com.package.paid & com.package.free.

This means that nothing is shared between the 2 apps (DB included).

You can also use ANT scripts to build both apps from the same code base, I just changed it manually every time I needed to build a version.




回答2:


Make sure that you have changed the package= in the AndroidManifest.xml



来源:https://stackoverflow.com/questions/6059416/how-to-keep-two-version-of-an-android-application-in-the-same-device

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