10

During the upgrade of my android application, I changed the package name. But Android market doesn't allow to upload the changed package name application as an upgrade. If I upload the application as a new application, will the user have two applications on his/her device? How can I make sure that the user doesn't have to download the application again from scratch without reverting the change of my package name?

James Haigh
  • 1,192
  • 1
  • 12
  • 25
yogsma
  • 10,142
  • 31
  • 97
  • 154

3 Answers3

12

two package = two different application in market place. Once you upload one app, its package should be same. Also, the key should be same.

Sarwar Erfan
  • 18,034
  • 5
  • 46
  • 57
  • I have used the same key, but different package name for my first uploaded application. – yogsma Jan 06 '11 at 06:26
  • you cannot change the main package name. If you do so, it cannot be treated as same app. – Sarwar Erfan Jan 06 '11 at 06:40
  • I am not sure why you had to change package after you published the app. You should rethink your decision of changing package name. If not possible, then forget (and put a link to new app in the market description?) the old app. – Sarwar Erfan Jan 06 '11 at 06:48
  • @Sarwar Erfan : I didn't changed main package name but i changed all other package name... so, I am afraid... It will work OR not? Let me know... Please.... – Bipin Vayalu Sep 10 '12 at 10:07
  • @BipinVayalu: If you have not changed ****, then there is no issue. – Sarwar Erfan Sep 10 '12 at 11:20
  • @Sarwar Erfan : Thanks for your quick reply... I have not changed main package name... So... I safe... – Bipin Vayalu Sep 11 '12 at 07:59
10

Android market is only concerned about the package name in your manifest, not the actual packages name in the source.

You could try to give the old package name in the manifest attribute, then for activities give the new package name instead of relative (ie .MainActivity)

Like this:

<manifest package="your.old.package" ...>
   ...
   <application android:name="your.new.package.MainActivity" ...>

Could work..

I plan to serve two versions of my app (paid/free) this way and using same project and code.

J.G.Sebring
  • 5,934
  • 1
  • 31
  • 42
  • interesting!! I will try on my next app. – yogsma Mar 09 '11 at 15:52
  • You are correct, Tapirboy. Android does not care about the name attribute that you place in your Activity tags; it only cares about the package attribute of your manifest tag, so far as determining the identity of your app is concerned. If the package attribute of the manifest tag is changed, then Android will consider the app with that change to be a completely different app. – Carl Jun 29 '12 at 02:32
  • 1
    I vaguely recall some issues with the Eclipse plugin if the manifest package and application name are different. This may no longer be an issue, but I definitely had to wrestle with Eclipse when using this approach. That was well over a year ago though. – Jeff Aug 15 '12 at 16:43
  • @Tapiboy I am having same problem that my old app having different package name and currently developing app having different name..so by using your above solution is it possible to have new package name on old one on google Play(market)?? and one more thing that how can i change the current package name on google market? – Swap-IOS-Android Dec 03 '12 at 13:49
  • @SwapAndroid AFAIK - You can not change the package name on a deployed application. You'll have to either rename package in your source or deploy new app using new package name. (or try the technique described above) – J.G.Sebring Dec 04 '12 at 11:08
  • @Tapirboy yes i want to try above technique but can you please explain me in details..i mean old package name and new package name..is there any documentation on particular this technique?? – Swap-IOS-Android Dec 04 '12 at 11:10
  • I might as well add that ultimately I didn't use this solution but made a library of the shared functionality. This made maintenance and building apk-file lot's easier. – J.G.Sebring Dec 04 '12 at 11:13
0

If you change the package name, it's treated as a separate app - not just in the market, but apk's in general will only 'replace' the same package name (and only if they're both signed with the same key).

Although it's possible to phase over to a new key by signing an intermediate package with both keys, there's currently no easy way to phase over the package name.

The best that can be done is this:

  • New apk version is signed with the same key, but has a different package name.
  • When installed, the new apk arranges to use the shared_prefs with the old package name.
  • The data is copied across to the new package name.
  • The new version requests that the old version is removed, and the user sees the uninstall dialog.

Note app data is usually kept here:

/data/data/pac.kage.name/

I haven't tried this, so I can't give anymore details yet. You may also be interested in my request for a seamless way of transitioning the package name.

Community
  • 1
  • 1
James Haigh
  • 1,192
  • 1
  • 12
  • 25