I am building a launcher application that I would like to update over the air. I created a service class that successfully checks and compares App version numbers to determine whether an update is needed. If the compared apk version is higher than current version, I download the apk from my cloud server, and then bring up a dialog to install it.
The conflict I am facing is that the update will not install. I receive an error "An existing package by the same name with a conflicting signature is already installed". I am beginning to wonder if my methodology is correct. How can I resolve this? Here is what I am doing.
Once an update is confirmed, I display a dialog and on press of the confirmation button I use an Intent to parse the app URL
Intent i = new Intent(Intent.ACTION_VIEW);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setData(Uri.parse(appUrl));
startActivity(i);
finish();
This actually posts a notification that I have to click and press install on. Once I do, it attempts to install, but then gives me the error on conflicting signatures.
Ideally, I just want it to install without having to see the notification. Thank you in advance.
You need not necessarily use Playstore or any other app hosting service to manage your application upgrades. Your users should enable: Install from un-identified sources (on their android handset)
For auto-upgrade you must release all your APK's with the same Signature. If you just build and run the application from Eclipse, the APK file generated in DIST folder is signed with Debug key (the default key of each machine)
Now if you build the same Code from different machine, the debug key values will be different and you would get the error: "An existing package by the same name with a conflicting signature is already installed" while installing the new APK
Here are a few solutions to it:
Always release the APK for auto-upgrade from same machine (this is definitely impossible)
Sign all the APK's with same signature. In Eclipse: Right click on project > Android Tools > Export Signed Application Package
You are setting it up almost correctly, but you should also set the data type:
i.setType("application/vnd.android.package-archive")
Additionally, do not call finish() after startActivity(). It is not necessary and might cause issues with the new Intent.
Your signature conflict is another problem. See this answer. The APK you are trying to install is signed with a different key that the currently installed one.
Finally, there is no way to install an APK without the user's explicit interaction (unless you have root, of course). This is intention for security reasons.
I have seen the "same signature" error when deploying directly from Android Debug Bridge. I am thinking you will not be successful in this approach, because:
Android security always requires user authorization to install updates (unless you are rooted, or are part of the system like Google Play Store auto-update.
Google play always has to kill the running process to update it. This probably will be ok if you service and the application are actually separate installations (i.e. two apks).
The same signature error I received in ADB is usually when the system is requiring me to completely uninstall the original signature application. Two applications with the same signature cannot be installed concurrently; something is triggering Android to not perform an 'upgrade' of the same package.
Here are the allowable ways to perform an upgrade:
Is there a way to automatically update application on Android?
Related
I've reinstalled windows and accidentally removed the key-store file that I've used for my project. I try to make a new one, but something is not inserted like the last time(alias maybe.) Now I have a problem: When I start to update the.apk file I get the following message:
An existing package by the same name with a conflicting signature is already installed.
My application automatically checks for project updates (new version) on a private server. The problem is that some people already have an app on their phone.
My idea was to compare keys and if it's different to ask the user to remove old apps in some dialog or something like that.
Is something like this possible, if not what are my others options ?
Thanks.
You need to release a new app with a new packagename.
If you no longer have the keystore used to sign your first app, you can never update it again in Play Store.
If you distributed your app manually and have not released it via Play Store, your users can uninstall the app signed with the lost key and install the new one.
There is no way to show a dialog as you cannot update the app. You can only replace it as described above.
when i try to update version in my android app to own site. The problem will be occured during the installation. that's
App not installed
An Existing package by the same name with a conflicting is already
installed.
Can any one help how to download updated app without uninstall.
Thanks in advance.
you have to change both
android:versionCode="4"
android:versionName="1.0.4"
android:versionCode is a integer, eveny update increment by 1
android:versionName can any string
and you use same Keystore
If your installing from your own site, don't increment the version code and name of new apk your uploading, use the same code and name of already existing apk, it will replace the existing one so no need to uninstall the app.
Try by enabling the "install app from unknown source" in device settings
Best way to do Even if your using the app for internal purpose you can sign the app using live keystore(not debug keystore) and upload it in your own site.
Another way to avoid getting your scenario:
If you want only some particular users to download the app that is the reason if you have hosted your app in your own site means, google provides an option to do this for testers where you can add their email in alpha testing or beta testing so that whenever you upload an apk to playstore those users who you have added will be notified and can update the app without uninstalling the existing(this wont be visible to all users who you have not added).
I want to export a new version of my APPLICATION, and i want to force the user to uninstall and reinstall the app for the new version (for different reasons). Is it possible?
Changing the signature of your app, will do the trick. What happens is that the system will warn the user when installing the new app that this app was found but with a different signature. The user has to uninstall the current app before the new app can be installed.
A more direct way than this does not exist. And there is a chance that many users won't understand why the app does not install. You should try to make your app so that this won't be necessary. Uninstalling the current app will also mean that the users loses it's data.
Another option is to change the package name in the manifest file, but this will mean the user loses all it's app data. Because the app will be installed as totally new app.
It's bad....
Rolf
Change the signature / key of your apk. I have read the this forces a full uninstall on the devices
Screenshot from eclipse.
I had submitted an application to Google play store that is running on the real server.
On the other hand, I am still improving the application with a fake server. The reason of having 2 server is because all data in the fake server will not affect the real server.
Whenever I want to do demonstration with the real server, I have to uninstall the test app and download the real app on Google play stall. After the demonstration, I have to uninstall the real app and then install my test app on the android phone. It is kind of troublesome after doing this more than 2 times a day.
Is there any way I can install both the test and the real app on the same phone?
I tried to rename my package name. But I found the refactor function in eclipse not a clean renaming. I have to manually rename some of the file and this take up a lot of time.
Just wondering if there is any other better way to do it. It would be good if there are some suggestion that I can try.
Replace your debug key with your production key and set the appropriate passwords to allow the signing. This way Android will let you update/overwrite the old version.
In Eclipse, select Window --> Preferences--> Android --> Build
You can have your keystore pointed here
However, your key store must use the same profile name and password as the default key store.
Please allow me to explain the problem, I built and released and android app that uses google map. The certificate used to sign that app was lost and so I couldn't release the next update under the same name as the previous per google play rules.
For this reason I was forced to sign the app with a new certificate and rename the app. Now user with previous are reporting issues with double instances of the same. indeed not much of difference in those two instances except the names and certificates used to sign them.
So my question is, how can ease the transition work for my users, I know uninstalling the old version and installing the new does the trick, but I am just wondering if there is some level of control that I can implement either through code of settings in google play to make things clearer and easier for the app users?
Also if you think my perspective of the problem is wrong too, please suggest a better one. Thanks in advance!
This question: Implicit intent to uninstall application?
Will show you how you can use and fire an intent that will start the uninstall process for the user.
You can use the PackageManager to find out if the old version is present. If It is create and launch an uninstall intent. Perhaps tell the users that you are going to do that with a dialog or something before launching the intent.
Maybe you can detect if your old app is installed and prevent the user from using your new one until it's uninstalled. Ex. using an "if" statement on your main activity that creates an alert dialog if it detects that your old package is installed and directs user to uninstall it before continuing. Just a thought!
Android - check for presence of another app