Android: Error while installing APKs
Follow these steps to overcome the issue.
- Disconnect all devices connected to system, and close all emulators running on System.
- Turn off Instant Run feature from settings.
- Perform a clean build.
- Turn on Instant Run feature from settings.
- Perform a clean build.
- Connect your device/start your emulator and ensure it is online.
- Run the project by selecting the device/emulator.
Note:
1) You should not have different instances of Android Debug Bridge(adb) running on system.
2) If using Genymotion then make sure that you use the custom sdk path mentioned in the Genymotion settings the which you mentioned in the settings of Android Studio.
These steps are likely to solve your issue, however it may also be a problem with android versions.
For Redmi and Mi devices turn off MIUI Optimization and reboot your phone.
Settings > Additional Settings > Developer Options > MIUI Optimization
Check Answer here
Turn off the Instant Run in Android Studio. Follow the steps below:
File >> Settings >> Build, Execution, Deployment.
Click on Instant Run and unckeck "Enable Instant Run to hot swap code/resource changes on deploy".
Click on "Apply" and "OK".
Try running the application again. It should install the app now. You can re enable Instant Run again anytime.
EDIT (Android Studio 3.0)
Disable Instant Run (Android Document)
To disable Instant Run:
- Open the Settings or Preferences dialog. (For Mac, Android Studio -> Preferences)
- Navigate to Build, Execution, Deployment > Instant Run.
- Uncheck the box next to Enable Instant Run.