Android apk replace vs Update - android

I have an application already installed on the mobile, am trying to install the update version of it.
I placed the apk inside the data/data folder, using file manager at the path,am trying to install it -
it shows a dialog to replace but not upgarde (Signed with the same key-store and version code/version name has an incremental value).
Could someone explain me more on this?

There is a difference between installing and subsequently, updating, apps off Google Play. Applications installed via a File Manager, for instance, will always prompt you to replace and not update an application. Side-loading apps on devices directly, does not have that mechanism to update. This is true not only for your app, but for every app.
It does not matter how it was signed or even the increment of your app's version.

Upgrade is only possible when you actually follow the installation procedure from Android Market. Else, it would just be a replace.

Related

Update system app in android

I have developed an android app and put this as prebuilt APK in AOSP.
So the app will be installed in /system/app as a system app.
The app has update function itself by downloading and installing the newer version APK.
But it does not work because system app cannot be updated.
Is there any way to update self-made system app?
System app can be updated, in two ways:
Updated by the ota updating, this will change the app directly, and the app still exist on /system.
updated by using package install api, this need the new version apk have the same signature with the one on /system, and the new version will be installed on /data. That means, if the device is reset, the new version will lose.
Ota update is a normal way for system app updating.
Yes, you can install an updated version of your original system app into the /data partition, provided that:
1. Both app versions are signed with the same key;
2. The updated app’s versionCode is greater than or equal to the original app’s.
One way to do this update is to use the following adb command: adb install -r <your updated apk file>. Then you can test your updated version without having to rebuild your AOSP code.
Note that your updated version in the /data partition will be removed via a factory data reset. In this case your original system app will take effect again.

App not installed. An existing package by the same name with a conflicting signature. Two app with same prefix package name [duplicate]

In my emulator, when I try to do an upgrade of my apk programmatically. I get:
Android App Not Install.
An existing package by the same name with a conflicting signature is already installed
I'm still in the testing phase of this upgrade, so the file I download is a signed apk of a previous version, which I think should work without any issues.
From the suggestion in: an existing package by the same name with a confilcting signature is already installed I tried to run the emulator both in debug mode and in normal mode... neither worked.
Any thoughts on what I'm missing?
I had the same error message, but these answers did not help. On a 4.3 nexus 7, I was using a user who was NOT the owner. I had uninstalled the older version but I kept getting the same message.
Solution: I had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
The problem is the keys that have been used to sign the APKs, by default if you are running directly from your IDE and opening your Emulator, the APK installed in the Emulator is signed with your debug-key(usually installed in ~/.android/debug.keystore), so if the previous APK was signed with a different key other than the one you are currently using you will always get the signatures conflict, in order to fix it, make sure you are using the very same key to sign both APKs, even if the previous APK was signed with a debug-key from another SDK, the keys will definitely be different.
Also if you don't know exactly what key was used before to sign the apk and yet you want to install the new version of your app, you can just uninstall the previous application and reinstall the new one.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
If you are using the debug apk, the key that is used to sign it is in
C:\Users\<user>\.android\debug.keystore
If you use that same key, there should not be a conflict when installing.
If you don't want to bother with the keystore file, then just remove the package altogether for all users.
Connect your device with Mac/PC and run adb uninstall <package>
Worked for me.
Ref: https://android.stackexchange.com/questions/92025/how-to-completely-uninstall-an-app-on-android-lollipop
If above solutions did not work for you then you may have doing something as following ..
1) installing the app from Appstore.
2) updating it with sign APK with same package name updated version.
So basically there are two kinds if APK's.
1) you uploaded on playstore known as original APK.
2) download from playstore known as derived APK.
In this case basically you are downloading derived apk and updating it with original APK.
For let it work fine uploaded new signed released APK in the internal test mode on the Google Play Store and download the derived APK to check the update scenario.
There is a difference between signed and unsigned APK files. Most likely you had an unsigned on there previously. You just need to delete the unsigned before you install the signed version. How this can be accomplished varies on the exact version, but in general, go on the emulator to settings-> application, long click your app, and delete/remove/uninstall it.
If you use multiple users at android, verify that the app is uninstalled everywhere.
It may be application is not uninstall successful. If your device is this case, you can try this method.
First get the package name of the application, e.g 'com.xxx.app', you can use Root Explorer and find it from Manifest file(RE can decode the file). then you can use this script to uninstall it:
adb shell pm uninstall com.xxx.app // replace to package name that you want to remove
I had an issue where both debug and release build won't install on devices I used for debugging. The same msg would appear when trying to install the new version. The only workaround was to uninstall the current version and install the new one.
It looks like Android studio marks the apk it installs so that installation using the package managers would distinguish between version installed for debugging and versions downloaded from Google play or other external sources (this never happened to me when using eclipse).
There may be another reason when your application will not update when you either change/add/remove shareId in AndroidManifiest.
"android:sharedUserId"
Please check that also.
To prevent would recommend to use sharedUserId in your application despite in your current requirement you need or now.
Same package error:
Create a new Package in your app with different name.
Copy and paste all file in your old package to new Package.
Save Code.
Delete old Package And Clean and rebuild project.
I had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
I tried all the above and it did not work.
I found that in spite of uninstalling the app a new version of the app still gives the same error.
This is what solved it:
go to Settings -> General -> application Manager -> choose your app -> click on the three dots on the top -> uninstall for all users
Once you do this, now it is actually uninstalled and will now allow your new version to install.
Hope this helps.
I just choose uninstallAll in Gradle Bar. It worked for me.

Self updating android system application with root access

I have created my custom ROM from aosp. I have also included my application, lets call it myCustomInstaller.apk (1.0) in the custom ROM while building. The application basically is kind of Google play Store. The application has system privileges and can install or remove applications silently.
I am able to install, update or remove any other applications. The problem I am facing is, When I am updating the myCustomInstaller.apk to 2.0 itself, the application is also installed silently, I am able to see the latest version installed in installed apps, but when i restart the phone, myCustomInstaller app reverts back to the original version.
I really don't know how to proceed, How is google playstore updating itself, and installing other application? Do I need any other permissions to make the updated version of myCustomInstaller app persist?
I am using this for silently installing, yes I do modified code for updating and removing
https://code.google.com/p/auto-update-apk-client/
Did you make sure to increment the android:versionCode in your Manifest? If not, the updated version, which will only get stored in the /data/ directory will be deleted when you boot.

Android App Not Install. An existing package by the same name with a conflicting signature is already installed

In my emulator, when I try to do an upgrade of my apk programmatically. I get:
Android App Not Install.
An existing package by the same name with a conflicting signature is already installed
I'm still in the testing phase of this upgrade, so the file I download is a signed apk of a previous version, which I think should work without any issues.
From the suggestion in: an existing package by the same name with a confilcting signature is already installed I tried to run the emulator both in debug mode and in normal mode... neither worked.
Any thoughts on what I'm missing?
I had the same error message, but these answers did not help. On a 4.3 nexus 7, I was using a user who was NOT the owner. I had uninstalled the older version but I kept getting the same message.
Solution: I had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
The problem is the keys that have been used to sign the APKs, by default if you are running directly from your IDE and opening your Emulator, the APK installed in the Emulator is signed with your debug-key(usually installed in ~/.android/debug.keystore), so if the previous APK was signed with a different key other than the one you are currently using you will always get the signatures conflict, in order to fix it, make sure you are using the very same key to sign both APKs, even if the previous APK was signed with a debug-key from another SDK, the keys will definitely be different.
Also if you don't know exactly what key was used before to sign the apk and yet you want to install the new version of your app, you can just uninstall the previous application and reinstall the new one.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
If you are using the debug apk, the key that is used to sign it is in
C:\Users\<user>\.android\debug.keystore
If you use that same key, there should not be a conflict when installing.
If you don't want to bother with the keystore file, then just remove the package altogether for all users.
Connect your device with Mac/PC and run adb uninstall <package>
Worked for me.
Ref: https://android.stackexchange.com/questions/92025/how-to-completely-uninstall-an-app-on-android-lollipop
If above solutions did not work for you then you may have doing something as following ..
1) installing the app from Appstore.
2) updating it with sign APK with same package name updated version.
So basically there are two kinds if APK's.
1) you uploaded on playstore known as original APK.
2) download from playstore known as derived APK.
In this case basically you are downloading derived apk and updating it with original APK.
For let it work fine uploaded new signed released APK in the internal test mode on the Google Play Store and download the derived APK to check the update scenario.
There is a difference between signed and unsigned APK files. Most likely you had an unsigned on there previously. You just need to delete the unsigned before you install the signed version. How this can be accomplished varies on the exact version, but in general, go on the emulator to settings-> application, long click your app, and delete/remove/uninstall it.
If you use multiple users at android, verify that the app is uninstalled everywhere.
It may be application is not uninstall successful. If your device is this case, you can try this method.
First get the package name of the application, e.g 'com.xxx.app', you can use Root Explorer and find it from Manifest file(RE can decode the file). then you can use this script to uninstall it:
adb shell pm uninstall com.xxx.app // replace to package name that you want to remove
I had an issue where both debug and release build won't install on devices I used for debugging. The same msg would appear when trying to install the new version. The only workaround was to uninstall the current version and install the new one.
It looks like Android studio marks the apk it installs so that installation using the package managers would distinguish between version installed for debugging and versions downloaded from Google play or other external sources (this never happened to me when using eclipse).
There may be another reason when your application will not update when you either change/add/remove shareId in AndroidManifiest.
"android:sharedUserId"
Please check that also.
To prevent would recommend to use sharedUserId in your application despite in your current requirement you need or now.
Same package error:
Create a new Package in your app with different name.
Copy and paste all file in your old package to new Package.
Save Code.
Delete old Package And Clean and rebuild project.
I had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
I tried all the above and it did not work.
I found that in spite of uninstalling the app a new version of the app still gives the same error.
This is what solved it:
go to Settings -> General -> application Manager -> choose your app -> click on the three dots on the top -> uninstall for all users
Once you do this, now it is actually uninstalled and will now allow your new version to install.
Hope this helps.
I just choose uninstallAll in Gradle Bar. It worked for me.

Upgrade apk downloaded from own web server

I need help in upgrading apk file. I have apk file developed for android 2.2 and I donot wish to publish my apk on android market. I published apk in our own webserver. And i could download it to my android mobile. Now the issue is that how can i upgrade apk file by publishing in our webserver.
My questions are:
How android market does apk upgrading?
How to upgrade a binary in android mobile with new version of which old version is already installed?
I used android built in view using intent which actually Re-installs apk not upgrading.But i don't want prompts asking "Do u want to install application?".
I want the apk to be upgraded once user click upgrade button without showing prompt to user, like doing in android market.
Is there any method to upgrade apk in android?
Are there any restrictions doing that?
Are there any specific permissions i need or i need to set in manifest file.
Once you've downloaded the APK, Android itself decides if the program is installed and needs to be upgraded, or if it is a new installation. Users can decide for themselves whether to upgrade or not.
Besides how to find out when there is an update available, it's not possible to upgrade it without prompting the user with the "Do you want to install". Android doesn't allow third apps to install apps unless the phone is rooted and your app has root access, but I think that this isn't your target group.
I have no experience with that but what you could try is loading classes manually from your server and then store it in the assets folder.
http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html
This is one approach, I don't think that it's very handy and easy but it would work.
Hope it helps!
PS:
And just because I'm wondering, is there a reason why don't you wanna publish it on the Android Market?
When you are publishing an App on your private web server, you need to create a process through which you can check for new version .There is No in built method for doing this .
I have created one as well.

Categories

Resources