Android_Install failed version downgrade - android

I'm going to update my apk on GooglePlay Store and I know that i have to upgrade the version code and name in manifest file however, it made install_failed.
Installation error: INSTALL_FAILED_VERSION_DOWNGRADE
Please check logcat output for more details. Launch canceled!
I modified the version code and name like this: android:versionCode="2" android:versionName="1.0.5"
Did i make it wrong?

Just uninstall the application on your device first and then install the fresh one.

When you are installing via adb you can pass -d to allow version downgrade
adb install -d -r your.apk
-r will also replace the existing app

Installation error: INSTALL_FAILED_VERSION_DOWNGRADE Please check logcat output for more details. Launch canceled!
I solved it by using the command prompt,navigating to project folder >adb uninstall package (you can get the package from Manifest.xml file).
In my case :
D:\projectFolder\AndriodApp>adb uninstall com.example.app
Again launch the App in emulator or mobile.

just use this:
$ adb -e uninstall your.application.package.name

Apparently the versionCode of your currently installed version of the application is greater than 2, thus resulting in a failed installation on the device.

This happen when your installed apk version less than version by which you are trying to build apk. For example you just upgrade your version and try to build apk with it but you already a installed apk in your device which was build by the previous one.
In this case you must uninstall the previous apk and build a new one with the exiting version.

I just disabled it first in setting>apps>allapps>app and I was able to install using regular command:
adb -r name.apk

First thing you need to do is check versionCode and versionName for palystore apk and then increment number by one for both versionCode and versionName.
for instance:in playstore versionCode="42"and versionName="1.4.2" then change it versionCode="43" and versionName="1.4.3" in your latest code

Ajay Takur is correct. Your App's current version code should be greater than the playstore one.
But do refer to this answer once. It may solve your problem.

In my case, I had to remove and uninstall the version on the device and then running the project. It reinstalled the version in the IDE and it worked like a charm.

Another take on the same error message: in Android Studio (unlike Eclipse), the version code/name are listed in the gradle file. If they're present both there and in the manifest, the gradle ones take precedence.

Spent an hour beating my head against the wall on this so want to share a specific quirk. Uninstalling the app via the headset didn't work - this error message still appeared, but uninstalling via sidequest and then installing the new apk worked. Good luck out there.

Related

Getting error "The package appears to be corrupt" while installing apk file

I am having a weird problem.I got this error after I updated Android Studio from 2.3.3 to 3.0..The problem is when I try to install apk file it says
App not installed.
The package appears to be corrupt.
I have tried generating apk in both debug and release version and tried to install but whenever I install apk it show the same message..
When I run the android project from android studio it is working.
May be the gradle problem but couldn't fix it.
Please help
After searching a lot I found a solution:
Go to Build-> Build Apk(s).
After creating apk you will see a dialog as below.
Click on locate and install it in your phone
Enjoy
As I got this case at my own and the answers here didn't help me, my situation was because of I downgraded the targetSdkVersion in gradle app module file from 24 to 22 for some reason, and apparently the apk doesn't accept another one with downgraded targetSdkVersion to be installed over it.
So, once I changed it back to 24 the error disappeared and app installed correctly.
When you are releasing signed apk , please make sure you tick both v1 and v2 in signature versions
See below screenshot for more info
This is weird. I don't know why this was happening with me while generating signed apk but below steps worked for me.
Go to file and select invalidate caches/restarts
After that go to build select clean project
And then select Rebuild project
That's it.
In my case; If you receive this error while updating your application, It may be because of the target SDK version. In such case you will receive this error on logs;
"Package com.android.myapp new target SDK 22 doesn't support runtime permissions but the old target SDK 23 does"
This is because your previous aplication was build with a higher version of sdk. If your new app was build with 22 and your installed application was build with 23, you will get The package appears to be corrupt error on update.
In my case, the target phone had the app already installed, but in a "disabled" state. So the user thought it was already uninstalled, but it wasn't. I went to the main app list, clicked on the "disabled" app, uninstalled it, and then the APK would go on.
Running a direct build APK will work. But make sure you uninstall any previously installed package of the same name.
In my case by making build, from Build> Build apks, it worked.
None of the answer is working for me.
As the error message is package corrupt , I will have to run
adb uninstall <package name>
Run app again / use adb install
In my case, I had a problem with my module level build.gradle file.
I somehow had removed the line
compileSdkVersion 32
from the file.
This didn't prompt any issue during the build time but only when installing which is where "The package appears to be corrupted" line occurred.
Adding the line back solved my issue.
Please re-check your build.gradle and AndroidManifest for any anamolies since the corrupt message is very ambiguous and hard to debug the exact cause for the issue.
By version number, I mean the versionCode in the app/build.gradle file
The Scenario:
I have an APK installed. Its version number is 152430.
I was trying to install a new APK (by downloading the new APK file) and updating the existing app. The New APK was having version number : 152427
Since the New APK was having version number less than the already installed APK, it was throwing this error.
The solution:
The version number needs to be higher than the installed APK version.

App won't install after updating google play services (8.1 to 8.3)

In my build.gradle I have:
compile 'com.google.android.gms:play-services-wearable:8.1.0'
compile 'com.google.android.gms:play-services-fitness:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
and everything works like a charm.
When I change services' version to the latest 8.3.0, I get something like this:
Installing com.example.app
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.app"
pkg: /data/local/tmp/com.example.app
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
DEVICE SHELL COMMAND: pm uninstall com.example.app
DELETE_FAILED_INTERNAL_ERROR
My SDK is up to date, Android Studio alerts me of the newer version and my device's services version is 8.3.01
Am I missing something? I didn't find anything in the changelog and I'm stuck with this for hours...
EDIT - solution is simpler than you may think
I wasn't expecting this as I didn't even have my older app version installed, but some data was still there. I just needed to install old, working version once again, clear the data, uninstall, and the problem is gone. All credits to Alex K and his answer.
For whatever reason, Android is having a tough time uninstalling the old version of the app while trying to sideload the new version.
To fix this, you can manually uninstall the old version of the app. Go to Settings, then Applications, then tap on your app, clear the data, then Uninstall. After that, try installing the new verison of your app again, and everything should work just fine.
This happens sometimes when you have conflicting versions of apps.
This is for your reference only.
In the debug environment, a Provider with the same name possibly is exsited. Try to edit the android:authorities="xxx" in the AndroidManifest.xml to some other value.
When you repeat to install a android apk, this failure would possibly be shown. Try to open the menu of your emulator:
settings->applications->mange
applications-> select the application->select "unistall".
and then install your apk again.
I'm not sure, just have a try?

Xamarin : Application not installed issue

When I install my application in debugging mode on my Android mobile device, it seems to be installed.
However, after signing the application and publishing it, it's not installed on my phone. (Release mode)
It says: Application not installed.
I tried a few things but cannot resolve this problem. I also tested with another Keystore but it still cannot be installed.
I verified Xamarin Studio options but everything is OK, does anyone have an idea?
The correct process of creating apk is given below
First change your build type to Release from debug.
Clean
Rebuild
Right click your android project and click on archive
After successful archive click on Distribute and click on Ad-hoc
Create keystore file
After finishing click on Open Distribution
Your apk file is ready.
I know I am late in party. But I believe it could help someone to resolve his issue.
Sometimes the issue is unsupported Architecture.
You can resolve it by
Android Project>Properties>Android Options> Advance>Supported Architecture.
Here you can check the supported architecture according to your device and the issue would be resolved. (I believe app should support maximum of architectures so check them all).
Hope it would help.
For OS X and windows the commands are same:
For windows please download: MSBuild Command Prompt for VS2015
For release version (the actual problem you are facing): type in command tool:
msbuild /p:Configuration=Release Path\To\Your\ApplicationProject.csproj
If this doesn't explain your problem I would post directly on their forums or contact their support. That could also help if you could find the installation log, there is probably an explanation why it fails to install.
I found the solution here https://forums.xamarin.com/discussion/comment/72399/#Comment_72399.
The answer from Felix Alcala works perfect. No more "App not installed" messages on device.
Open the SDK Locations in Xamarin Studio
Preferences/Projects/SDK Locations/Android
and set Java SDK(JDK) to
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Finally, generate the .apk file again.
Check the target sdk when debug and check version of your android device.
Version of android device should be equal or greater than the target sdk in debugging mode.
You may encounter this issue if you have installed then uninstalled the same app from your phone.
In Visual Studio, go to
Tools > Android > Android Adb Command Prompt
Ensure your phone is connected and debugging is enabled on your phone. If this is done properly, the name of your phone should show in Visual Studio next to the run button.
In the adb command prompt, enter this command:
adb uninstall [your package name]
E.g.
adb uninstall com.mypackage
You should then be able to install your APK
This also happened to me, after downloading the .apk from my android device browser and pressing the Install button, it said "App not installed" with no further information. After downloading it several times, (each time getting the same issue) I finally got the message that I could not download de .apk because I did not have enough storage in my device. So, check if you have enough storage in your phone before trying to install it, as the error message is only "App not installed" instead of warning that there is not enough space.
Google Play scans the device for threats before installing anything from unknown source. When you try to install for the first time, it will ask if you want to install, if you let it install it'll work fine. But second time, even if it asks or not, it won't let you install. One solution for this is, go to your play store, under Play Protect disable ' scan device for security threats' and then install it, it should work! One other reason for the error could be that app is already installed in your device, uninstall the app or change the signature and then try to install it, It should work! If these don't work, try to debug through usb, adb would show you the error and then you can work on that!

Is there any way to ignore INSTALL_FAILED_VERSION_DOWNGRADE on application install with the Android Debug Bridge?

It seems like the most recent Android 4.2 has introduced this error condition on installation when one attempts to install an APK with a lower version. In prior versions of Android, one would be able to install older APK's simply via adb install -r <link to APK>. For debugging purposes, I frequently need to re-test older APK's; and the -r flag would replace the older build in older Android versions. Is there a work-around here to ignore [INSTALL_FAILED_VERSION_DOWNGRADE]?
It appears the latest version of adb tools has an "allow downgrade flag" that isn't shown in the adb help, but it is shown in the "pm" help on the device. So use:
adb install -r -d <link to apk>
You can try and use adb uninstall -k <package> and then installing the older apk.
From the adb usage guide:
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)
I've tried it myself with my apk, and it seems to work for most of the data (some data like RawContacts was not saved)
Did you enabled Multiple account on your device (and push your apk via ADB)?
If so you have to remove the apk in every account. After complete uninstall, your push will be OK.
For me, only this works fine:
adb install -t -r -d myapp.apk
Btw, the app, which I want to replace and downgrade is a system app
In my case it was a stale version of Google Play Services included with my project. I am using Android Studio. I ran an update on the SDK, and imported the updated library, and that error went away. So my suggestion: update to the latest libraries that are referenced by your project.
I also faced the same problem.It can be resolved with below steps which are easier than deleting any apk from the device -
1) Run command "adb logcat | grep -i version" on the terminal
2) Look for the particular line, which will be shown at the end of the logcat -
"Downgrade detected: Update version code 5011 is older than current 9109"
3) copy the current version( for eg 9109) and paste it in AndroidManifest.xml as shown below -
android:versionCode="9109"
Now clean and rebuild the application and it should work fine.
Try uninstalling previously installed version of app using-
adb uninstall com.package.name
and then install/run your app again
See documentation: https://developer.android.com/studio/command-line/adb
-d: Allow version code downgrade.
Simply doing adb install -d your-app.apk should help.
You might have installed from a separate copy of the code where the version number was higher than the copy you’re working with right now. In either case, uninstall the currently installed copy, or open up Settings > Apps to determine the version number for the installed app, and increment your versionCode to be higher in the AndroidManifest.
It may be a problem with the Google Play Services dependencies.
Sometimes, it is NOT the case that:
a) there is an existing version of the app installed, newer or not
b) there is an existing version of the app installed on another user account on the device
So the error message is just bogus.
In my case, I had:
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
But when I tried
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
I got androidX related errors, as I had not yet upgraded to androidX and was not ready to do so. I found that using the latest 16.x.y versions work and I don't get the error message any more. Furthermore, I could wait till later when I am ready, to upgrade to androidX.
implementation 'com.google.android.gms:play-services-maps:16.+'
implementation 'com.google.android.gms:play-services-location:16.+'
implementation 'com.google.android.gms:play-services-gcm:16.+'
Uninstall existing installed app.
check if you have changed project package name ,
Because of package name , It gets conflicts with existing app.
For people facing issues with Xiaomi:
adb shell pm uninstall <package_name>

android apk file installation

I am trying to install apk file in G1 device and get following error:
Failure[INSTALL_FAILED_ALREADY_EXISTS]
I have already change the name of main file using Manifest too. change the icon too.
though the same problem is come over.
Any suggestions are welcome.
Thanks in Advance..
Sunil Mishra
Do you have some valuable application data, that prevents you from uninstalling the app, and then installing the new version?
Try the ADB command for reinstalling already existing application:
adb install -r <path to your .apk>
You have to change the name of the package, which is a lot of work with no benefit. What you should do is uninstall it. Ether choose Settings->Applications->Manage Applications and remove it from there or issue the command:
adb uninstall com.package.name
The android Manifest file has version numbers and works based on the package name not the dispayed name so I think if you update your verion numbers in the manifest, repackage and deploy then you should be able to install as an upgrade which will preserve your user data. I've done it 45 times for my app in the process of debugging.
regards,
Fin

Categories

Resources