android apk file installation - android

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

Related

Android Studio Error "Installation did not succeed. The application could not be installed. Installation failed due to: 'null'"

I am trying to run my app on my Xiaomi RedMi S2 from Android Studio 3.5. It throws an error while installing the app on the phone:
Installation did not succeed.
The application could not be installed.
Installation failed due to: 'null'
I had the Same issue on a MAC, this is how I solve it,
note: I was tried the method that mention #Manoj Kumar,
Un check this field in Preferences/Build,Execution,Deployment/Debugger
1.Open run/debug configuration dialog:-
Run> edit configurations.
Navigate to You app > General > Installation Options > Install Flags.
add install flags -r -t.
Note: This flags means adb install -r -t apk path
I hope this will help.
Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present.
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
For me, restarting the Android Studio solved the issue.
File> Invalidate Cache / Restart
Restarting the device after enabling developer mode and allowing usb debugging did the trick for me.
You has installed the app which has same package name with different debug signature file.
The different signature file lead to the fault
At first please uninstall the apk that you has installed with different signature file。
Then you install the apk again ,You'll sucess!
When you connect the mobile, it starts in the charging mode.
Simply change the mode to Transfer Mode (Transfer Media or photos mode).
Now install the app again and it will work.
It may be because of your phone's memory is full. you can delete some data from your phone and then try. for me it worked.
Tip: run from terminal adb install path/to/app.apk
Why? Cause it will give more information about the error - actually pointing to the place in manifest with the error. For example - in my case it was: 'Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]'
A simple (unintended) restart to the computer did it for me (I tried to run on emulator)
In my case I was using third party library, I have removed that library from gradle and reinstall the app. Successful
Add this line to your '/gradle.properties':
# gradle.properties
android.injected.testOnly=false
Check https://gist.github.com/xujiaao/5fd127a72979cdc3c70dcc1324786f87 ,it work for me.
Just use in this link. Disable Preference -> Build,Execution,Deployment -> Debugger -> Use libusb backend
Uncheck Use libusb backend
that's all. Enjoy your coding...
Chech to manifest file and search for a required library tag. And delete it. I solve it by this way.
I was trying everything but nothing seemed to work. But then I suddenly noticed that my phone blocked installation, so I unchecked "reject this to install" and at the another try the security checkbox popup, asking for letting the installation. After allowing everything worked.
Conclusion: I just were probably too angry that i didn't noticed this popup earlier.
Just check in the AndroidManifest.xml file to make sure you are using permission and libraries that you need for your app. In some cases you may have wearable libraries and permissions in your AndroidManifest.xml file and yet you do not need them. This happened to me when I was adding more activities and Android Studio was creating them as Wearable Activities
I'm trying every thing from the answers but only one solution is just free some space on your phone for proper install the debagged app.
I had this problem at one point in time. the only solution that worked for me was to delete the SDK and download a new vision. It turned out that ADB had a problem and it was not able to detect my device. uninstalling the SDK and installing another resolved the problem for me
Create a signed apk and drag that apk to the emulated device, that worked for me
go to the path of your debug apk, and rename of your apk like :
myApp.apk to myApp1.apk(just rename it)
and try to run it again.
its works for me every time :)
TRY THIS!
Delete the build folder in your App and re-build the project, it should work now.
Accept agreement of terms and conditions by opening Google Maps and Google Chrome on a newly created emulator, your application might be using Google play or location services.
I was faced this same error while running application. I am just rebuild the program and run again the application..
For me ı had this problem i fixed it
because i did not use Android studio Emulator i was using another one
i fixed the problem when I enabled Developer Mode from Emulator
and that is all for
I hope that can help some one like me
Regards
As I am currently using IntelliJ IDEA 2021,
In order to work for me, I had to disconnect android device(Emulator)
to Computer by USB and Free up some space on phone storage
Lastly It was to refresh my device by restarting it(phone)
Again, I had to go to:
Settings, Debugger,
And Check Hide debug Window on process termination
I hope this helps, if U are using IntelliJ IDEA, for instance.
You might wana check your phone storage too. Your apk wouldn't install if there is no space
I resolved the problem by switching off the emulator, clean the project and rebuild it again.
Its because the devie on which you want to install the app does not have enough space, just clear some items to get space. Then try agian

Android_Install failed version downgrade

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.

Failure [INSTALL_FAILED_CONTAINER_ERROR] when trying to install android apk package using adb for platform 4.1

I generated an apk package for my android application. and I tried to install the package (apk) on android platform 4.1 (level 16) using the adb command but it genrates error:
Failure [INSTALL_FAILED_CONTAINER_ERROR]
when trying to run with eclipse (run button) for the same platform (4.1 level 16) it works without a problems
this behaviour is not reproduced for platform 2.1 and platform 3.2
You need to make changes in AndroidManifest.xml. The change which you need to do is. Change :
android:installLocation="preferExternal"
to
android:installLocation="auto"
this worked for me.
This will happen if android:installLocation is set to "preferExternal" and you have an AVD with a too small SD card. Increase the size of the SD card or change installLocation to auto in AndroidManifest.xml.
I got this error when I deleted my app after changing the MainActivity's name. idk if the app didn't install due to space issues or the phone thought the package is corrupt but deleting the dalvik cache and rebooting solved it for me.
INSTALL_FAILED_CONTAINER_ERROR is also returned when trying to install an apk that contains native libraries compiled for a different architecture.
Try running "logcat" from the "adb shell" after you get the error. If it reports a java IOException "Failed to extract native code" then you need to install the apk on an avd created for the native library architecture, or include native libraries in your apk for the architecture on your avd/device.
I wasnt able to change manifest of the build, so for me was the solution unmount SD card, install app and then mount it back.
i change installLocation="auto" in manifest but not work. I found problem in something wrong with my sdcard.
So, i change android:installLocation="preferExternal to internalOnly.
It work for me!
My issue got solved by wiping the emulator data

windows-7: could not run android apps on device

I'm trying to import android applications from other computers. after sometime they're running on emulator finally now but not on the device .
probably the reason is the driver I installed , because adb devices did not recognize the device so I installed this manually and still Bluetooth Peripheral Device not installed when I check in device manager!
at first it gave me this error : the app stopped running unexpectedly !
now the error is :
Re-installation failed due to different application signatures.
You must perform a full uninstall of the application. WARNING: This will remove the application data!
Please execute 'adb uninstall com.newboston.aida.android2' in a shell.
Launch canceled!
any idea how to solve this?
I just typed adb uninstall and then the name of the package in command prompt and it works !
Uninstall the application from android device or emulator, and try to re-run / install the application. Because debug.keystrore is different for every devices.
Try to create a new virtual device. Maybe it'll work when you install the driver first. It's possible, that your phone will be recognized then. And I don't think win7 is the problem.
If possible can you just Change the Package name of the current working project. And try to Build it. it might get other path and would run. This is a kind of Patch i know, but just try it out....
I get the same problem while moving the application from one system to another... some time the problem comes due libraries path and the api level.
So you can check the api level is the same in the application buildpath in the other system.
Hope this will help you.

How to resolve different signature error

I got Calculator source code from google's android.git.kernel.org and successfully build the project without problem. But when I launch it in eclipse, I got this
Re-installation failed due to different application signatures.
[2011-08-14 03:37:04 - JvCalculator] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2011-08-14 03:37:04 - JvCalculator] Please execute 'adb uninstall com.android.calculator2' in a shell.
[2011-08-14 03:37:04 - JvCalculator] Launch canceled!
I don't think I have the application in my emulator. So it's not uninstall/install problem, I think. I suspect that the google's source code has different signature. If so how I can change it? Is there anybody that resolved this issue? Or do I have to build a new project with copy and paste?
Note that when I tried following while connecting emulator,
adb uninstall com.android.calculator2
I got a simple one-word error message "Failure".
"How can I install Calculator (or any app) from the git repository (or from source) to any device that already has it installed?" You can't change the signature because that is a closely guarded secret at Google or (any other app developer). What you can do is change the application's package, with a different package the system will think its a different app.
I had this exact problem. Uninstalling via adb did the trick:
adb -d uninstall org.janeullah.android.healthrecords
Try making a new emulator.
Try cleaning the project.
Had same error, but I was testing the app on a device that had the app already installed (some old version). After uninstalling it worked without renaming the packages or other changes.

Categories

Resources