When running the application in Android Studio, you may get trouble in dealing with the error “Unknown Failure: Error while installing apks”. How annoying it is! right? However, take it easy by reading the on-screen instructions shown below.
But before getting started with guidance on how to fix Error While Installing Apk Android Studio, we need to know about Android Studio as well as how it works.
What’s Android Studio?
Android Studio is the official Integrated Development Environment (IDE) specially created for Android development. It is available for download on Windows, macOS and Linux based operating systems.
In a sense, Android Studio is an all-in-one tool for engineers who want to create offerings for the Android platform.
It’s not too much difficult to install an apk file in Android Studio. However, you can download it manually via an emulator.
1. First you need to make sure you have this directory. (X:\Program Files (x86)\Android\android-studio\sdk\platform-tools). If you don’t see this directory in your SDK, launch the SDK and AVD Manager (execute the android tool) and install “Android SDK Platform-tools”
2.Copy APK file into (X:\Program Files (x86)\Android\android-studio\sdk\platform-tools). In this tutorial we will use APK file get from this tutorial. Yes, Candy Crush 😛
3.Go to Android Studio > Run Android Virtual Device Manager (AVD) > Start emulator
4.Go to Start > Run > Cmd. then
5.After successfully installed, you will see result in command prompt like below
There are a couple of solutions to solve, Try any of these:
- Just uninstall the apk which you have already installed on your mobile before installing the new apk every time.
- Or you can just ignore that error and press “OK”, nothing bad happens if we ignore it. (i still do this every time it all works fine without any problem)
- Or you need to modify your AndroidManifest.xml, Change android:testOnly=”true” to android:restOnly=”false” or remove this attribute.
Actually what happens behind this is, when the device on which you are trying to install the APK already has an APK of same app installed in your mobile. So the Android Studio needs to uninstall that previous APK and install the latest APK again. To perform this action Android Studio is asking our permission to proceed.
How do I resolve the “Error while installing APKs” error when I used to run a program connecting my phone on Android Studio?
Oh it’s a very common error in Android development( Studio).
I usually run into this. When ever I see the error I just hit shift+F10 again and the application install normally. No issue at all.
Okay you want something more than that fine.
- Attach your phone to your PC and give android studio run command, now select the physical device to deploy the build.
- Fine now gradle build is started now remove the USB cable from the phone.
Tada: You got your “Error while installing apk” error.
Another problem might be your system does not have necessary permission to install the app. Just remove the USB cable and attach again. You will see a dialog asking to confirm to add PC as trusted source to “Allow USB debugging”.
Then everything should work properly if not please check these setting:
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APK
- Session ‘app’: Error Installing APK Problem
This is probably due to a move or a rename of your project or project folder.
You can try the following to resolve the issue:
- Disable Instant Run
(MAC: Android Studio > Preferences > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run)
(Windows: File > Settings > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run)
- However most of the time you may want to actually use instant run, so the recommended fix would be to Rebuild the project. To rebuild, select the menu Build -> Rebuild Project.
As usual, if all else fails, it is worth repeating those steps above and restarting the targeted device and your computer. Hope this helps someone out there!