I am trying to install apk from android studio. Initially I got below error:
So I disable instant run as suggested in many post on stackoverflow like this How To Stop Installation of Multiple Slice APK In Android Studio 2.3.
Now I am getting below error after disabling instant run:
java.io.IOException: An established connection was aborted by the
software in your host machine Error while Installing APK
I have only one instance of android studio running when I got this error.
Android studio version is 3.3.1. What can be cause of above error.
Also I am not able to install apk using adb install command. I am getting message failed to install apk with no detail message.
You can restart Android Studio : File -> Invalidate caches/restart
And i think you install ADB-Idea pluggin to uninstall or clear app data very easy with shortcut.
ADB-Idea pluggin :
Link
So I found out why I was not able to install apk from studio or from adb install command. Issue was due to my pc usb port was blocked by network administrator of our organization as my usb port usage period expired. So if anyone facing issue of not able to install apk and getting error as mentioned in question and no solution working for you than please check if your pc ports are not blocked by your organization network admin. I took approval to use usb port and it is working now.
You have got the first error because of :
You are testing your project_A on a emulator_E
As you had the app project_A, installed on the emulator_E, in previous run.
Now you started the execution of your project_A, again on the emulator_E.
The Android_Studio and emulator_E, both came to know that, the apk is already on the emulator_E, so just, whatever the new changes are, will be synchronised, within the, already available project_A apk, on the emulator_E.
But as the whole process takes some time, you uninstalled the apk of project_A on a emulator_E.
And now project_A on a emulator_E is not there, but Android_Studio tried to synchronised it, which leads you to the ERROR_1
Solution
You are following many approaches, for the same thing.
You are starting your project, project_A on the emulator_E by :-
via ADB INSTALL from the command line too
With Instant Run too
With Instant Run too
And you are not keeping the previous apk as it is there on the emulator_E, after starting the execution too.
Uninstall it from emulator_E, but before you start the execution for emulator_E. Which lead to your Android Studio to some dangerous STATE_A and, Android Studio is not tested by google for such types users
It may seem harsh, and obviously it is not the answer, but this is the exact problem, which is leading you to the such case.
Related
Im trying to generate an APK to test my android build, it used to work before, i dont know what went wrong that it stopped working, whenever i try to run on device either on android studio or my own device, it does not build even though its error clean. App actually installs, but when its about to run it closes down and this message appears
Heres what i got from checking the logcat on Android Studio: https://imgur.com/a/FdE4WMo
Try uninstalling the app from the device and then run it again.
The dev / debug build uses an encryption key that's specific to the machine so I think that maybe you are trying to install a different app over the original one?
I decided to generate even more money and develop my first app for Android. When I want to deploy my app (just the skeleton code from IntelliJ/Android SDK) with one MainActivity I am getting the following error.
The log of the run looks like this.
5/07 21:32:35: Launching app
$ adb install-multiple -r -t
C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_7.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_6.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_8.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_9.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_4.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_5.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_3.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\resources\instant-run\debug\resources-debug.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_0.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_1.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\dep\dependencies.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_2.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\instant-run-apk\debug\app-debug.apk
$ adb shell pm uninstall com.stark.purewallpaper
Unknown failure: Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: com.stark.purewallpaper
at com.android.server.pm.Settings.getInstallerPackageNameLPr(Settings.java:4671)
at com.android.server.pm.PackageManagerService.getInstallerPackageName(PackageManagerService.java:25342)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:25348)
at com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:21062)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:924)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:1486)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:193)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:25884)
at android.os.Binder.shellCommand(Binder.java:642)
at android.os.Binder.onTransact(Binder.java:540)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3329)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4763)
at android.os.Binder.execTransact(Binder.java:739)
Error while Installing APKs
The event log looks like this.
21:32 Executing tasks: [:app:assembleDebug]
21:32 Gradle build finished in 493 ms
21:32 Failed to finalize session : -118
Things I tried on the phone:
re-enabled dev mode
re-enabled USB debugging
tried different default usb configurations like "picture" or "file" transfer
tried activating "wait for debugger" option
Things I tried in IntelliJ:
deactivated "Instant Run"
installed all SDK tools, including the "Google USB Driver"
cleaned and rebuild the project
IntelliJ can clearly see my device, it even detects the type correctly.
I am on:
Windows 10
IntelliJ 2019.1.1
Newest Android SDK that comes with IntelliJ
I decided to try this on Android Studio 3.4 and I'm getting same error.
I am able to run the app inside the emulator/virtual device but not on my Samsung Galaxy S10+. Any ideas?
If none of the solution mentioned above works, you can turn off the instant run option as shown in the from setting
Try this:
Build > Clean Project
Build > Rebuild Project
Build > Make Project (Ctrl + F9)
Try to use this File > Invalidates cache/restart
Lastly, try to sync project with Gradle file which can be found in the right corner top
I finally, after days, found out what it was. My company forced a security policy on my phone after I configured the e-mail app to receive work mail. After deactivating the policy in security settings I was able to deploy the app without any problems.
Go to your Apps menu from your Android device Settings.
Find your app, probably name is PureWallpaper according to your logs.
Uninstall it.
Then try to install it again.
Explanation:
According to your error logs, it looks like your device has the same app installed but with different signature signed with different keystore.
This was happen to me many times ,
This is just a warning ,It try to say that the app you want to install on your device is already installed on your device ,but the problem is it is signed with different credentials .
For eg:-
their was a release apk of the same app installed on your device and you are trying to install debug apk on same device.
This error also try to say that the that all the data which are saved by that apk will be lost.
Side note:- after clicking OK,sometimes android studio gives me error that it is unable to install but actually it installed.
I am unable to run application on any android phone. I have Android Studio 3.3 , and it used to work fine. And now suddnely it shows Error while Installing APK . Session 'app': Error Installing APK
I tried :
-- Clean, Build ,
-- Invalidate caches and Restart ,
-- Disabled Instant Run ,
-- Checked devices for storage , USB debugging
Nothing works. I cannot install the apk on android device.
Any one knows how to resolve this issue? Any help is appreciated.
Thanks.
I've faced this issue before, & turns out the device just had insufficient memory for the app.
Try free up some memory on your device.
This question seems too broad to give an appropriately specific answer. I can give some recommendations that you might have not done yet.
Remove app from device and install it again.
Maybe you have not allowed USB debugging in developer options.
Maybe you have not allowed USB debugging on this phone. The dialog that appears whenever you connect the phone to the pc.
Also, I would suggest adding a screenshot of the error
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!
I have this strange error when installing apk on device, from Eclipse. The console gives error message: Failed to install, but in fact the file is installed.
Also, the application doesn't start after the installation, I have to do it manually.
I have done the this same procedure over and over again, without problems, but now the error occurs.
Thanks!
I've found that sometimes a device gets stuck in a strange state, and no matter what you do will give odd errors on install. Turning the device itself on and off again usually cures the problem.
Does your ADB work normally when issued from command prompt? Try installing any apk manually using
adb install <filename.apk>
and see what is being returned. It may be an issue with the return from adb not being correctly recognized by eclipse. I'll also suggest changing the USB port to check if the same issue is occurring.
Try to remove the app on the device before installing the new apk...