Android: Can't overwrite existing app with new version - android

I'm developing a new version of an existing app. This is a complete redesign from the ground up, so I've created a separate project for this update. Now I need to test the app's behavior when upgrading from v2 (old version) to v3 (new version). The two projects have the same applicationId, module name, and are signed by the same key. However, when I install v2, and then subsequently install v3, the old app is not overwritten; I end up with two installs. What am I missing that is causing Android to view these apps as distinct?

Two APKs cannot both be installed on the device if the have the same application ID. The module name doesn't matter, and a different signing key would just force a complete uninstall/reinstall instead of an update.
Double check your application IDs for minor typos.
Also check if you have an applicationIdSuffix defined in your build.gradle. It is fairly common to append something like .debug to debug builds so you can have both a debug and release build installed on your device. If that's the case, make sure you are trying the upgrade with a release build.
You can also log (or show the application ID) in a Toast to verify that they are different and what you expect. Just call BuildConfig.APPLICATION_ID to get the current application ID.

Related

Android app does not upgrade for a new version after download it from the server

I have a problem updating a newer version of the Android app.
Every client has different requests for the app, like colours of a button, exclude some services that they do not need, etc, and they have the opportunity to upgrade it on the login app page from our server (new a new version is ready, a popup will appear).
When I upgrade for the main provider (developer debug) the app upgrades from a newer version. If I uninstall the app, and put the APK of the provider, let's call 'A', and in the login page switch for the provider 'developer debug' and try to update the app, I actually can download the APK but I can't upgrade the App, it appears 'application not installed'.
I checked the versionCode on the 'developer debug' on Gradle, and the integer is higher than the provider 'A'.
I checked the manifest as well, I did not find any conclusion.
There can be multiple reasons for this but as far as I understand you can have one of these issues:
Check if you actually created a release version of your app and you are not using the same debug version. Create a release from
Android Studio
Build -> Generate Signed Packages (or some like this)
Even if you did create a new release package of your app, make sure its created using the same developer signing key which was used for the old or previous version of your app.

Replace current application with rebuilt version from new Android Studio Project

Information:
Currently, I have an application on the market that is actively used. Rather than refactor all my code to rebuild the application, I rebuilt the whole application from scratch in a new Android Studio Project with identical/updated information (applicationId/packageId/versions). I want to upload this apk to the google play store to have it update users normally.
Problem:
Testing this situation on my devices hasn't worked. I have a device with the 'old' application on it and I attempt to install the 'new' version and I receive this error during installation: "The package seems to be corrupt"
Question:
Is this process even possible? If so, why might I be getting this error? If not, what is the method by which I could do this?
Thanks!
It is possible as you say, however you need to keep three things in mind:
Package name must be the same
Signing key must be the same
Version number must be higher than last version
Other than that, there should be no problems
You are not going to be able to push the update to the play store with your new project, because the file that you sign the application with (signing key), is associated with your project old SHA 1 and without that file, you cannot push an update.
I suggest you create a new copy of your old project and work there

Android publishing two apps with same package id

Inside of the Android Developer Console I would like to have 2 applications, MyAppName and MyAppName-Staging. The only differences between these two apps would be:
The API environment they point (prod vs. staging)
One would be for external Play Store release while the other (MyAppName-Staging) would be intended only for internal users in my company.
Would I be allowed to use the same package/app ID for both of these or would I need to change the package ID for each one? My assumption is I would need to change it, if thats the case can I use the same code base but just change the app ID and rebuild the apk to achieve this?
For additional context I've built this app using Nativescript. So all packaging info is handled through a package.json file and code signing must be done through the CLI. I just want to make sure I can't code sign myself into a situation where I can't release my build to production (the MyAppName build) Thanks for any guidance.
From my experience, Google Play Store doesn't allow 2 apps having the same package name to be published. You would need to either:
Change your package name
or if you want to have the same package name regardless,
Upload your staging app (with the same package name) to the beta channel of your live app then select users to be invited to the beta.
The developer console has the concept of beta builds that you can distribute to list of members or open to play store. You could build with same package name but pointing at different environment and distribute through there.
Then point back to prod when you release your official build.
https://support.google.com/googleplay/android-developer/answer/3131213?hl=en

How to keep both released and updated APK?

After downloading my app from the Play Store I tried to run it from Android Studio
but got this error..
Is there a simple way to keep both apps?
What is the problem
There is conflict between your production APK and your debug APK.
The debug APK (installed by Android Studio) is signed using the debug.keystore (keystore).
The production APK is signed using one you created, with a passphrase only known by you.
So the device refuses to replace an application by another one claiming to be the same (same packageName) but that has a different signature (eg: has not been signed using your passphrase, so potentially not by you -- the author).
How to solve it
You now have two choices:
You want to have both applications side by side, then use another packageName for debug. This is easily done using Gradle:
android {
// ...
buildTypes {
debug {
applicationIdSuffix '.debug'
// ...
}
release {
// applicationIdSuffix
// ...
}
}
}
You want to keep only one application at a time: you just need to remove the old application to install the new one (with another signature).
just change the package name of application until you finish your editing
Reason why you are getting this error
Anytime you try to install an application with the same package name of any application installed in your device, you get this error.
Solution
Try to modify your package name of application in your current Android Studio
Another option is to modify android studio to sign your apk with the release keystore in debug as well, although thats generally not recommended.
That way when you install either apk you will keep your data.
Only problem is that both apks must be at the same versions to be interchangeable (you will not be able to install a lower version apk, at least not easily).

Android shows signature conflict error while installing app

I want to provide an updated version to my app,
It is downloaded from my site not from google play service.
When I download the updated version its not replacing the old version, instead it shows error"An existing package by the same name with conflicting signature".
Is there any solution to replace the app without manually un-installing the older version from the device.
Every android application file – apk has two main things:
package name – (unique id of app like com.example.application)
signature
More information about the second. Every apk file should be signed with developer keystore. If this is the debug version it could be debug-keystore.
In this keystore there are some information about developer and other information.
When you install application android system at first checks package name – whether or not this application have been installed already. And if so system checks signatures. The signature of installed app and app to be installed must be the same. Otherwise you will get error, you describe in your question.
So, the answer is: not, you can't install another application with the same package name if the signatures of installed and to be installed apps are different.
You must uninstall previous version and install new version, if you need new version.
If That is Developed By You or a Developer.
Once Check weather the Entire Code and Package Names are Same or not, in the Manifest file..
If Its Not that app is not from you or your known developer means.
You need to Uninstall Previous Version and Install New One,
That Error You are Getting Is that App is Not Signed, means When we are Using UnSigned App It cannot Replace at the part of Signed app. first of all make your app as Signed.
Check more at Here
How to Make a App as self-Signed at here
Yes, the error message already describes your issue. Your issue is that your app is not signed with the same signature as the previous version.
So to prevent this error message you must sign the app with the same signature as the previous version.
More details about application signing can be found in the Android Developers documents.
to protect the identity of the application each revision(update) requires the same signed key(SHA1) which was used for the earlier release.
Eclipse by default uses debug-key to sign in all the packages.
Use the same method by which you first installed your app and everything should just work.

Categories

Resources