Changing the package name of an upgraded Android application - android

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?

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

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.

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.

Related

Can i publish a new app by using existing app package name

I want to know that can I publish a new android app with existing app package name?
i.e I have a photo editor and its package name is com.myapps.photoeditor. now I want to make new version but i will publish VPN. so the new app will totally different.
VPN will be ok with existing package name com.myapps.photoeditor?
plz guide me
No, you cannot do this. Package name basically I unique ID for an app. When a package name is associated with an app and it is published over google play this is a unique ID for that app. You cannot publish new app with the same package name but you can update the app.
You can't publish two apps with same package name as google consider it as primary key but story doesn't end here. There are two things you can do:
you can update your app, here updates mean you can remove existing feature, you can add new feature, you can modify existing feature but you have to handle it properly.
But you want the new feature in a separate app then you should change clone your existing code and add new feature and change package name before publishing. (Not Recommended)
If you mean by package name as the applicationId in build.gradle, then the answer is NO. Your new VPN app will overwrite your existing Photo editor app.
If you mean by package name as the package name used by your source codes, then the answer is IT DEPENDS. YES you can use same package name in source code provided that you provide different name for applicationId. NO you cannot if you provide the same name for applicationId regardless of what you use as the package name used by your source codes.
Know the difference here: https://developer.android.com/studio/build/application-id
If you want to release a new app with applicationId (from app/build.gradle) same as any apps before, you can't do it.
If you want to update an existing app with complete new ideas or feature or name or type, having access to that app's signing keys and developer account, yes you can do it. Just release with version code greater than before

What is the difference between changing package name vs applicationId

What is the difference between changing package name vs applicationId to the final apk.
I know it is different for aspect of keeping source code, but lets say I got some app with package name a.b.c.d.
What will be the difference in the builded apk file
if I rename the a.b.c.d into q.w.e.r and then build the apk file
vs
change the applicationId into gradle with q.w.e.r
The package name is just to organize your code.
The applicationId, on the other hand, is used to identify your app in the Play Store. You will change this only if you plan to generate another app based on same code.
From docs (https://developer.android.com/studio/build/application-id.html):
When you create a new project in Android Studio, the applicationId
exactly matches the Java-style package name you chose during setup.
However, the application ID and package name are independent of each
other beyond this point. You can change your code's package name (your
code namespace) and it will not affect the application ID, and vice
versa (though, again, you should not change your application ID once
you publish your app). However, changing the package name has other
consequences you should be aware of, so see the section about
modifying the package name.
Some Android API like google map and firebase ask for your package name when you create the key. That package name they refer to is actually your applicationId. Yup Google insist on using the term package name for these API key. Don't get it confuse.
Taken from doc (https://developer.android.com/studio/build/configure-app-module#set_the_application_id):
"Note: The application ID used to be directly tied to your code's package name; so some Android APIs use the term "package name" in their method names and parameter names, but this is actually your application ID. For example, the Context.getPackageName() method returns your application ID. There's no need to ever share your code's true package name outside your app code."
Application id mostly used for:
Change the application ID for testing
Change the application ID for build variants
In this case, each build variant should be defined as a separate
product flavor. For each flavor inside the productFlavors {} block,
you can redefine the applicationId property, or you can instead append
a segment to the default application ID using applicationIdSuffix, as
shown here:
Every Android app has a unique application ID that looks like a Java
package name, such as com.example.myapp. This ID uniquely identifies
your app on the device and in Google Play Store. If you want to upload
a new version of your app, the application ID (and the certificate you
sign it with) must be the same as the original APK—if you change the
application ID, Google Play Store treats the APK as a completely
different app. So once you publish your app, you should never change
the application ID.
And package name is:
Although your project's package name matches the application ID by
default, you can change it. However, if you want to change your
package name, be aware that the package name (as defined by your
project directory structure) should always match the package attribute
in the AndroidManifest.xml file, as shown here:
The Android build tools use the package attribute for two things:
1- It applies this name as the namespace for your app's generated R.java
class.
Example: With the above manifest, the R class will be
com.example.myapp.R.
2- It uses it to resolve any relative class names
that are declared in the manifest file.
Example: With the above
manifest, an activity declared as is resolved to be
com.example.myapp.MainActivity.
Know more from Source
Once you upload the app on Play store you can't change the application id for that project , if you want to do then google play store consider as a different application.
In case of package name you can change it as you want.

Issues with application signature

I'm trying to create my own version of Gesture Builder. In eclipse I selected android project from existing code and I renamed the project and package name to new gesture. Then I added in android:fadeOffset = "1000" in create gesture xml(so that I can create gestures for letters like t and f) and in AndroidManifest.xml I set the version name to NewGestures and I set a different icon but when I try to run it I get this error message:
"Re-installation failed due to different application signatures. You must perform a full uninstall of the application. WARNING: This will remove the application data! Do you want to uninstall?"
From what I've seen online I need to match the signature used originally on Gesture Builder, but I've no idea how to do this on eclipse, shouldn't the signature have been handled properly when I created from existing code? Any help would be very much appreciated. I just need this app working so I can get a gestures library for a different application I'm working on for college.
This message concerns the application signature. This happens when you are trying to install an application on your device while an application of the same package name is already installed, but signed with a different certificate (see details here).
For example:
You have exported and installed your application using your Google Play keystore (so using your actual developer's certificate), and now you are running/debugging it from Eclipse, implicitely using the debug certificate (which is different)
You have runned/debugged your application from Eclipse at home on this device, and now your are running it/debugging it from Eclipse with another computer (which is using a different implicit debug certificate)
etc
Normally, below the error message, you have a button that allows uninstalling/reinstalling. If not, just uninstall your app manually and everything will be fine again.
versionName:
The version number shown to users. This attribute can be set as a raw
string or as a reference to a string resource. The string has no other
purpose than to be displayed to users.
package:
The package name serves as a unique identifier for the application.
The package name declared in your manifest.xml is what makes your application unique. Therefore, there can not be two application installed with the same package name at the same time. If you try this, your error occurs.

Are these two treated as same package names in android

So I have published an app on google play, but unfortunately I forgot the alias password for the signing certificate though I remember the password with which I signed the certificate.
After searching a lot I have come to a conclusion that I can't retrieve the alias password by any means and now I am publishing a new copy of app on google play.
Also I went through this post by Dianne Hackborn,
things-that-cannot-change.html
and package name is one out of them.
So , now if I publish this new app with the same package name and un-publish the existing app and a user who has installed the existing app with the existing package name now installs this new app I think that would be an error according to the above post.
But according to the package name conventions I have named the package as,
com.mycompanyname.beta
and for this new upload of the app , I want to use the package name,
com.mycompanyname.android so would these packages conflict ?
com.mycompanyname.beta and com.mycompanyname.android are different package names, so no, they won't conflict.
If a user has the first app installed (com.mycompanyname.beta), and then installs the second one (com.mycompanyname.android), they will end up with both apps installed on their device.
The app is identified by the package name. Therefor the package name needs to be unique. Thats why everybody uses some domain names for that to create a unique package (domains are unique, too).
They wont' conflict
com.mycompanyname.beta
com.mycompanyname.android
but for the safe use-case, this will do the work
com.mycompanyname.clientname.android
Changing package name will not be issue , Android SDK will handle references efficiently
From Android package Specifications
A full Java-language-style package name for the application. The name
should be unique. The name may contain uppercase or lowercase letters
('A' through 'Z'), numbers, and underscores ('_'). However, individual
package name parts may only start with letters. To avoid conflicts
with other developers, you should use Internet domain ownership as the
basis for your package names (in reverse). For example, applications
published by Google start with com.google. You should also never use
the com.example namespace when publishing your applications.
The package name serves as a unique identifier for the application.
It's also the default name for the application process (see the
element's process process attribute) and the default
task affinity of an activity (see the element's
taskAffinity attribute).
Caution: Once you publish your application, you cannot change the
package name. The package name defines your application's identity, so
if you change it, then it is considered to be a different application
and users of the previous version cannot update to the new version
.
NO there will not be any conflict rather then made a copy of your app with different package
com.mycompanyname.beta and com.mycompanyname.android are different package names of your app.
It never be conflict each over. Both app can be installed in same device.
If it is conflict then better to check the manifest file of app package. May have same package. Then it make conflict. Your App package name should be like that
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompanyname.beta"
android:versionCode="1"
android:versionName="1.0" >
</manifest >
and other one
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompanyname.android"
android:versionCode="1"
android:versionName="1.0" >
</manifest >

Publish app in google play store

I try to update customers App in Google Play, this is my first time I do this.
I created a certificate, it seems to be fine. The app was packaged with appcelerator titanium.
When I upload the app in store I get this message:
The name ofupdated APK-Package (gdp.app) must be the same with the package I want to replace (de.gdp)
File Name I upload is: GdP.apk
What do I have to change?
You changed the package name. You have to use the same package name as the original .apk.
Change your package name back to de.gdp .
More information:
http://developer.android.com/guide/topics/manifest/manifest-element.html
"I wont to replace (de.gdp)"
well, you cannot rename your package. If you change your package name the store recognizes it as a different app.
so you cannot update it with different package name.
Renaming your package to gdp.app will solve the issue.
If the package name and signing certificate do not match those of the existing version, Market will consider it a new application, publish it as such, and will not offer it to existing users as an update.
So, you have to maintain the same package name of previous build.
See this link: http://lokeshatandroid.blogspot.in/2012/07/upload-apk-into-android-market.html

Categories

Resources