Android Emulator: Installation error: INSTALL_FAILED_VERSION_DOWNGRADE - java

I am currently trying to compile and test a small Android Application.
I am using Eclipse, and have SDK 4.2 (Api Level 17) installed.
I've set
<uses-sdk android:targetSdkVersion="17" android:minSdkVersion="8" />
although I've tried also different values (i.e. 17/17).
I do not use any GoogleAPI functions, nor do I use functions that are not available in API Level 8. Or at least I do not get any compile errors or warnings in that regard.
When I compile the project and run it on a real device running Android 2.2.1 the Application runs fine. However when I try to run the application on an emulator (Android Virtual Device) with Android 4.2, Api Level 17 I get the following error:
[2012-12-10 21:10:29 - SoftKeyboard] Installation error: INSTALL_FAILED_VERSION_DOWNGRADE
[2012-12-10 21:10:29 - SoftKeyboard] Please check logcat output for more details.
[2012-12-10 21:10:29 - SoftKeyboard] Launch canceled!
Logcat however is empty. I have really no clue, what this error even means...

It means you're trying to install an app with the same packageName as an app that's already installed on the emulator, but the one you're trying to install has a lower versionCode (integer value for your version number).
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, either:
uninstall the currently installed copy
or open up your phone's Settings > Application Manager to determine the version number for the installed app, and increment your <manifest android:versionCode to be higher in the AndroidManifest.
or https://stackoverflow.com/a/13772620/632951

You can also consider adding -d flag to adb install. It should ignore this error.
adb install -r -d abc.apk

First uninstall your application from the emulator:
adb -e uninstall your.application.package.name
Then try to install the application again.

This was happening in my project because I was using an XML resource to set the version code.
AndroidManifest.xml:
android:versionCode="#integer/app_version_code"
app.xml:
<integer name="app_version_code">64</integer>
This wasn't a problem in prior versions of adb, however, as of platform-tools r16 this is no longer being resolved to the proper integer. You can either force the re-install using adb -r or avoid the issue entirely by using a literal in the manifest:
android:versionCode="64"

This can happen when trying to install a debug/unsigned APK on top of a signed release APK from the Play store.
H:\>adb install -r "Signed.apk"
2909 KB/s (220439 bytes in 0.074s)
pkg: /data/local/tmp/Signed.apk
Success
H:\>adb install -r "AppName.apk"
2753 KB/s (219954 bytes in 0.078s)
pkg: /data/local/tmp/AppName.apk
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
The solution to this is to uninstall and then reinstall or re run it from the IDE.

In Marshmallow, I got this error,
Installation error: INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE
Please check logcat output for more details.
Launch canceled!
Looking for solution I searched and came here.
I deleted the app but still have this problem in Nexus 6. Later found that in,
Settings > Apps > [My app name] have to removed for all user.

INSTALL_FAILED_VERSION_DOWNGRADE
All Android apps have a package name. The package name uniquely identifies the app on the device. If same packageName as app that's already installed on the device then this error Showing .
You can uninstall the application from your device first and
then install the fresh one .
You could simply increase the number by one each time a new version is released.

I was having the same problem. I installed with
adb shell pm install --user <userId> test.apk
For some reason, there was no icon on the screen. It was a debug build and all other consecutive installs were not working. Simply uninstalling the package helped.
adb uninstall com.package.name

According to sdk src code from ...\android-22\android\content\pm\PackageManager.java
/**
* Installation return code: this is passed to the {#link IPackageInstallObserver} by
* {#link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
* the new package has an older version code than the currently installed package.
* #hide
*/
public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
if the new package has an older version code than the currently installed package.

I was having same problem. I was getting error when i tried to run in my android device not emulator.
sudo ionic run android
I am able to fix this by running
adb uninstall com.mypackage.name

you can try this:
adb install -r -d -f your_Apk_path

Do the following:
Simply uninstall the previous version of your application
Re-run the command
Enjoy :)

this happened to me when I imported an Android Studio App into eclipse.
I figured out the andoridmanifest.xml file needs to be slightly modified when importing from android studio project. I created a new test project, and copied over the headings to make it match. voila, issue solved.

This error appears in my android project with multiple kind of gfx files. At the end no change in the manifest file was accepted.
Because my lack of knowledge about the android devices I forget that my test device has a second User. This User also has an installed version of my app so I also have to delete the app for this user account and it works.

It may be a problem with the Google Play Services dependencies rather than an actual app version issue.
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 your current apk from the device then run
sudo adb uninstall com.package.name
It is the command to uninstall the apk via pc.
Then retry the build

the thing that kept on killing me was that i didn't know that this app was installed for my guest account (although I had uninstalled it for the other accounts..)
so i searched for the app in the app manager, and simply clicked on uninstall for all users

Just uninstall the previous Apk and install the updated APK

Related

Started failed Android Studio

When I start Android Studio I see the following:
Internal error. Please report to https://code.google.com/p/android/issues
java.lang.IllegalStateException: Couldn't create Engine
at com.google.android.filament.Engine.create(Engine.java:46)
at com.google.ar.sceneform.plugin.viewer.Filamentor$3.run(Filamentor.java:103)
How I can solve this problem?
Make sure you have folders .cache and .local owned by your user (not root).
To change owner you need to run this:
sudo chown -R your_user_name:your_user_group .cache
sudo chown -R your_user_name:your_user_group .local
Make sure you download the Application from the official android studio website. Install it again and give you laptop full access to the internet because apart from the Studio software it downloads many other plugins and sdk tools etc, so install it again giving it full access to the internet. I hope it helps.

Unknown failure (at android.os.Binder.execTransact(Binder.java:674)) Error while Installing APKs

My app had compiled and then it was installing the apk in my phone when a popup came asking me that the new installation will uninstall the previous version and then install the new one. I clicked OK but then after a while it shows this error:-
01/14 10:43:22: Launching app
$ adb install-multiple -r -t
E:\projects\Track\app\build\intermediates\instant-run-apk\debug\app-debug.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_4.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_2.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\dep\dependencies.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\dep\dependencies.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_0.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_4.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_1.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_5.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_6.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_9.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_8.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_7.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_1.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_3.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_0.apk
E:\projects\Track\app\build\intermediates\resources\instant-run\debug\resources-debug.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_2.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_3.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_5.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_9.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_6.apk
E:\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_7.apk
E:\root\Desktop\projects\Track\app\build\intermediates\split-apk\debug\slices\slice_8.apk
$ adb shell pm uninstall com.saveme.rehaan.track
Unknown failure (at android.os.Binder.execTransact(Binder.java:674))
Error while Installing APKs
Can someone please help me as to how i can solve this.
I had exactly same issue after moving the project files from one folder to another one and I solved it like this:
1. File -> Settings -> Build, Execution, Deployment.
2. Instant Run -> disable "I found it's enabled, then I disabled it".
3. Apply -> OK
nothing more.
Try below following steps:
While installing any app from play store it shows popup in order
to uninstall some apps to make free space for new app.
Uninstall some apps from your phone in order to free some space.
Clean your project (Build --> clean Project)
Run Again
If above solution does not work
Generate Debug apk.
Transfer apk in your phone and install from there.
Uninstall other apps until your app does not install.
------------ Hope it will work for you---------------

Android Studio emulator on Mac not working [duplicate]

Couldn't use x86 emulators, AVD manager shows warning "/dev/kvm is not found" and telling me to edit BIOS security setting to enable VT-x.
Re-installing HAXM resolved my problem
Steps:
Make sure SDK Manager -> Extras -> Intel x86 Emulator Accelerator (HAXM installer) is installed
Navigate to <sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/
Run ./HAXM\ installation -u
Run ./HAXM\ installation
For MacOS users running Android Studio, when you get this error then try these steps to open up your privacy settings.
You can also follow the answer from Divakar on this post here - /dev/kvm not found on mac
Thank you Apple for pushing me with your dumb*** app review rules from iOS to android development
You just need to "start" the HAXM. You can do this following this steps:
Open the cmd.
Type sc query intelhaxm, click enter and check the STATE.
If state is 1 STOPED, type sc start intelhaxm and click enter to start the HAXM.
Check the STATE again and it should be 4 RUNNING now.
Finally, you are now able to create and use your AVD using a x86 emulator.
Alternatively, when you want to stop the HAXM you should type sc stop intelhaxm.
Hope this helps y'all.
I had a similar message in the emulators area in Android Studio 2.1.
My emulator for a certain API (think 21) worked initially fine and was fully accelerated, then installed a couple of other images (Nougat x86/64 etc) and suddenly started seeing /dev/kvm not found and NO emulator would boot up.
In My Case, re-installing HAXM sadly did not help, but rebooting my MAC did (go figure).
But, I also noted that if you have installed an emulator image but not the related SDK for the API (which makes sense), then you get a similar pop-up when starting the emulator, which makes you think it may be a HAXM / KVM issue, which its not.
Hope this helps someone.
Update Bios Setting
Power on the system and press[delete] key to enter BIOS [EZ Mode]
Press [F7] key to enter BIOS [Advance Mode] as below picture:
(If press [delete] key to enter [Advanced Mode] directly and then no need to press [F7] key any more)
Select [Advanced] page and click [CPU Configuration] item
Select [Intel(VMX) Virtualization Technology] item and set to [Enabled]
Press [F10] key and click [OK] ,the system will auto reboot
On Mac OS, After installing make sure to allow Intel HAXM under "Security & Privacy".
This was the only way I was able to run the Android Emulator :)
Reinstalling and restarting did not work for me. Instead, I had to start my Mac in Recovery Mode (restart & press ⌘+R until Apple logo appears). Then open terminal from Utilities drop down menu. Type and run:
csrutil enable --without kext
You will get some warnings and instruction to restart for the changes to take effect. Restart and the emulator will run this time.
Reference:
https://blog.celogeek.com/201708/672/android-studio-emulator-haxm-on-mac-os-high-serria-10-13/
Just go to terminal and type
sudo chown 777 -R /dev/kvm,
then type
sudo chmod 777 -R /dev/kvm.
And restart android studio
And that's it..
In some case it may happened that for every start of android studio you need to type this commands First and then start android studio.
I couldn't install mine because I had HyperV enabled on my machine. Removed it and I was able to install the HAXM from the following link:
https://github.com/intel/haxm
Either your CPU does not support virtualization, or it is disabled in the bios. Go into your bios and see if you can find a setting to enable it.
I tried reinstalling HAXM a few times but kept getting the errors.
In my case I actually had to go into Bios Settings and enable Virtualization.
It worked for me. Just in case this helps anyone.

Android studio 3 - java.lang.RuntimeException: No server to serve request [duplicate]

After clean install of Android Studio I always get the error
Error:java.util.concurrent.ExecutionException:
java.lang.RuntimeException: No server to serve request. Check logs for
details.
and
Error:Execution failed for task ':Application:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
Java is up to date and the path is set.
I am new to Android Studio, what should I try?
We ran into the same issue, and have been able to find the root cause: The error message means that Gradle cannot connect to some worker processes. In our case, the process was for 'aapt2'. Running 'ldd aapt2' indicated that some shared libraries were missing (mainly GLIBC). Since we're using Docker based on Alpine Linux, it comes with a reduced GLIBC (glibc-musl). The solution was to simply install glibc in the Docker container.
I suggest you run ldd build-tools/{version}/aapt2
to see which libraries are missing from the OS. You did not mention your OS, are you also using Docker and AlpineLinux ?
In my case, I did not need to re-download the sdk. I closed Android Studio and ran the following command in the Terminal:
sudo chmod 777 -R ~/Desktop/AndroidStudio
...where, ~/Desktop/AndroidStudio was the folder structure after Root which I needed to mention in order to provide permission to read all the SDK packages and perform required operation as and when necessary by the Android Studio, because my Sdk folder was inside "~/Desktop/AndroidStudio".
I am running Android Studio 3.0.1 on Ubuntu 16.04 LTS. This worked for me perfectly :-)
This error occurred because you might have accidentally remove the executable flag from aapt2 which is located in $ANDROID_HOME/build-tools/27.0.2.
Try this:
Re-download the sdk (recommended)
followed by-
sudo chmod 777 -R $ANDROID_HOME
Note:
$ANDROID_HOME is the location where I put android sdk
Hope this helps !!
Had to uninstall Android studio and delete the following
SDK folder in AppData folder
Delete .gradle folder
delete .AndroidStudio Projects folder
and did a fresh install which solved .
I had this problem on lubuntu-16 32bit (and also some other problems too). all of the problems were solved when I updated my system to lubuntu-16 64-bit.
Here how I fixed this Issue:
1.Deleted .gradle folder.
2.Closed android studio and run as administrator.
On Start android studio will rebuild the folder you deleted.
sudo chmod 777 -R $ANDROID_HOME
Note: $ANDROID_HOME is the location where you put android sdk
Hope this helps !!
If it is possible for you, please delete the build folder of project and test building android project with any other version of build-tools.
in my case, build-tools version: 26.0.2 had problem, I tested with 27.0.3 and it solved my problem unbelievably :)
I ran into the same problem, and it turned out I had messed up the file permissions inside the android-sdk folder (more specifically android-sdk/build-tools/{version}), and some binaries were missing execution permissions.
In my case, I simply gave x permissions to the relevant files in that directory, but if you're not sure, I suggest you uninstall the android sdk, completely remove its directory and then reinstall it again.
So after investigating the issue for long , I have a concrete solution .
Let`s look into it.
Go to Android Studio -> Help -> Show Log In Files
In the subsequent folder that opens, open idea.log
This would present you with a log file which contains logs of processes right from when the studio started. Now in this file, you have to search for the possible issue. For some the issue might be due to
java.io.IOException: Cannot run program "/home/mmt/Android-Sdk/android-sdk-linux_x86/emulator/emulator-check": error=13, Permission denied
For some others, it may be some other. The point is that this file contains lot of irrelevant logs and you have to identify the one that is causing this issue. For me , after discovering the above issue, I granted permission to that particular folder using the below commands
cd $ANDROID_HOME/sudo chmod -R 777 emulator/
After this, rebuild your project and tadaaa.. problem resolved.
for me it was a virus that corrupted my files from the "build tools" folder. so I uninstalled everything and made a new installation of android studio, SDK and build tools.
For me, this is the side effect of another issue that I haven't root caused yet. Every once in a while, I get aapt2 failures because some file /tmp/ld-linux-x86-64.so.2 is "busy", with the following error message.
AAPT err(Facade for 1745790725): cp: cannot create regular file '/tmp/ld-linux-x86-64.so.2': Text file busy
Slave 1745790725 failed to start java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at ~/.../android-sdk-linux/build-tools/27.0.3/aapt2) are not corrupted.
When this happens I just rm that file and everything starts working again. I suspect this might be caused by me actually having two installs of adb (one through ubuntu via apt and one from Android studio) but I haven't had time to dive deeper.
I already had latest version of build-tool installed, so I just had to give permission to Android_home:
chmod 777 -R $ANDROID_HOME
and build again. This worked for me.
If you are on Windows 10 (sigh), close android studio and then right click on android studio icon and select 'Run as Administrator' from 'more' menu.
Build again.
You can run Android Studio as Admin.
I hope it will help you.
To Do So :
Right click
choose Run as Administrator
Best regards,

installation failed with message install_failed_uid_changed

I am running android app from android studio but failed to installed. Although I have uninstalled the app from mobile and have enough memory space in the mobile.
. Please What should I do. I have attached the alert .
Thanks
If your device is rooted you can try deleting your application's data from the device. To do so, delete /data/data/[app package name] folder or run adb shell rm /data/data/<app-package-name>. Then, try to install your app again.
For non-rooted device:
Change the ApplicationId of the app. Refer this link to change ApplicationId.
Build and install the app. The app will install successfully because it is treated as the new app.
Now uninstall this app which will clear the data.
Now change the ApplicationId to the previous one.
Build and install. It will install.
For rooted device:
Just delete
"/data/data/your.package.name"
on your device

Categories

Resources