I am using Android Studio 2.2 Preview. I am facing the issue
Failure: Install failed invalid apk
Error: While installing apk,
I also faced same problem. If you want install your application using USB. You have to check the (Install Via USB option in Redimi note4). Hope this will be helpful to someone.
Oh my goodness, after a long time I have resolved the issue by changing the ApplicationID: "com.company.2016app" to "com.company.app" in build.grade. It resolved all my issues. Now its working great.
For Android Studio on Mac :
Navigation Bar :
Android Studio > Preferences > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run
For Android Studio on Windows :
File > Settings > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run
Even after following all the suggestions, if it shows error then check your buildType in Gradle.
Make sure
signingConfig signingConfigs.config
is in release scope, not in debug.
Different solutions for the same problem:
1. uncheck the Instant Run
Settings > Build, Execution, Deployment > Instant Run.
2. Restart Android Studio
Click on File> invalidate Caches/Restart, then click on Invalidate and Restart button from the pop up window.
3. Check Device's memory
Sometimes your device don't have enough space to install new applications, in that case android studio through this error.
4. Check manifest for Activities Declaration
Make sure that your manifest.java have declared all of the used activities properly.
Hope it would help :)
This error comes with Android Studio lower than 2.4 when you try to enable Java 8 features in gradle settings following the instruction. Error can be reproduced in a new project with those gradle settings.
A higher version is needed, or a preview one.