开发者

I changed package name, changed the app_name but installer still overwrites previous version

For diagnostic purposes, I am trying to install to an Android device two slightly different versions of the same app.

In order to accomplish that, I duplicated the project and changed the:

  1. project name
  2. package name
  3. app name (as appears in the application's "android:label" in AndroidManifest.xml)

However, when I install the modified app, it overwrites the older app (with different project name, package name and app name).

Apparently, I am missing something开发者_开发技巧 else that needs to be changed, in order to let both projects exist on my Android phone side-by-side.

What is that "something else"?


I think you need to change the package name text in the Android Manifest. If you change the package in the eclipse properties menu for the project, it doesn't change the actual AndroidManifest.xml.

Edit: The package name identified in the AndroidManifest.xml is the unique indetifier for the application, but I think, perhaps, not necessarily referencing the root package of your Android project's source code. I would think that it's best practice for them to be one in the same, but I could see where you could easily release an alternate version of an app (i.e. paid vs free) by changing the manifest application package, but not changing the underlying source code. Not saying that this is necessarily good practice, but seems like a possibility. Here is some more info :

http://blog.javia.org/android-package-name/


I had a duplicate project with a different manifest package="__" value and it was overwriting and being overwritten by the original project when installing to the emulator, so the other answer is not correct.

The correct field to change was in build.gradle:

android {
    defaultConfig {
        applicationId "__" <--- change this value
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜