Changing the package name of an upgraded Android application

13,647

Solution 1

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

Solution 2

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.

Share:
13,647
yogsma
Author by

yogsma

Programmer. Founder of https://rentersvoices.com Developer of Android Application YFormulator (formerly Formulator). I used to write posts for Java Code Geeks here. Now I write better java code. Also you can check my github repositories github. You can download my ebook Spring Boot and Microservices Certified Scrum Master

Updated on July 17, 2022

Comments

  • yogsma
    yogsma almost 2 years

    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?

  • yogsma
    yogsma over 13 years
    I have used the same key, but different package name for my first uploaded application.
  • Sarwar Erfan
    Sarwar Erfan over 13 years
    you cannot change the main package name. If you do so, it cannot be treated as same app.
  • Sarwar Erfan
    Sarwar Erfan over 13 years
    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.
  • yogsma
    yogsma about 13 years
    interesting!! I will try on my next app.
  • Carl
    Carl almost 12 years
    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.
  • Jeff
    Jeff over 11 years
    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.
  • Bipin Vayalu
    Bipin Vayalu over 11 years
    @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....
  • Sarwar Erfan
    Sarwar Erfan over 11 years
    @BipinVayalu: If you have not changed <manifest package="your.old.package" ...>, then there is no issue.
  • Bipin Vayalu
    Bipin Vayalu over 11 years
    @Sarwar Erfan : Thanks for your quick reply... I have not changed main package name... So... I safe...
  • Swap-IOS-Android
    Swap-IOS-Android over 11 years
    @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?
  • J.G.Sebring
    J.G.Sebring over 11 years
    @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)
  • Swap-IOS-Android
    Swap-IOS-Android over 11 years
    @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??
  • J.G.Sebring
    J.G.Sebring over 11 years
    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.