Installation failed with message Invalid File

AndroidAndroid StudioAndroid Build

Android Problem Overview


> Installation failed with message Invalid File: > K:\project\app\build\intermediates\split-apk\with_ImageProcessor\debug\slices\slice_0.apk. > It is possible that this issue is resolved by uninstalling an existing > version of the apk if it is present, and then re-installing. > > WARNING: Uninstalling will remove the application data! > > Do you want to uninstall the existing application?

i am running my project in android studio 2.3 beta 3 .

Android Solutions


Solution 1 - Android

Click Build tab ---> Clean Project

Click Build tab ---> Build APK

Run.

Solution 2 - Android

I found the solution go to

> settings>build,execute,deployment>instant run>Enable instant run to > hot swap code /resource change on deploy(unchecked this option)

`

Solution 3 - Android

Just follow two steps

Step 1 : Build---> Clean

Step 2 : Build--> Build APK

Hope it works. Good luck guys

Solution 4 - Android

I solved it this way:

Click Build tab ---> Clean Project

Click Build tab ---> Rebuild Project

Click Build tab ---> Build APK

Run.

Solution 5 - Android

Hopefully, this should solve your problem.

Do follow the following steps.

1. Clean your Project

Cleaning the project

2. Rebuild your project

Rebuilding the project

3. Finally Build and Run your project

Solution 6 - Android

First, as already mentioned, try cleaning and rebuilding the project. If that does not work for you, try this:

Settings > Build, Execution, Deployment: Un-check Enable Instant Run to hot swap code...

This solved the problem right away for me.

P.S. I posted this answer since it's 2017 and I don't think this feature existed in 2014, so it wouldn't cause this problem.

Solution 7 - Android

Please follow the below steps File > Settings > Build,Execution,Deployment > Instant Run > Un-check (Enable Instant Run to hot swap code)

this is working for me

thanks

Solution 8 - Android

This happened with me when I copied a project code from one laptop to another one and tried running the project. What fixed this for me was:

  1. Delete the project's build folder
  2. Clean Project
  3. Build project
  4. Run

Solution 9 - Android

In my case, I had the same issue when the name of my project contains a "&" sign.The solution is to rename the project name,from file browser, so it doesn't contain any "&" signs and then from:

  • Build menu-> Clean Project
  • Build menu-> Build APK

I've tested it two times and it worked just fine.

Solution 10 - Android

For me it's:

Click Build tab ---> Clean Project

Rebuild Project

Build APK

Solution 11 - Android

follow some steps:

Clean Project
Rebuild Project
Invalidate Caches / Restart

Now run your project. Hope it will work.

It's work for me.

Solution 12 - Android

Work for me:

  1. Delete these folders
  2. Run app

enter image description here

Solution 13 - Android

Try this in gradle project dependencies { classpath 'com.android.tools.build:gradle:2.2.3' }

Solution 14 - Android

In my case , there was a single qutation ' in project directory and after removing it resolved

Solution 15 - Android

Delete the Intermediate folder after then run the project is working fine actually that APK builds to another system. Go to app/build/intermediates.

Solution 16 - Android

I found its work by restarting my phone :)

Solution 17 - Android

  1. Invalidate cache/restart
  2. Clean Project
  3. Rebuild Project
  4. Run your app / Build APK

These steps are enough to solve most of the problems related to Gradle build in any way. These steps helped me solve this problem too.

Solution 18 - Android

My issue was with my Android Studio install.

I am building out a new CI server and although I installed Android Studio and hooked up the SDK, etc., I did not open the studio with the project -- instead just went to the command line to build. When I subsequently opened the project in the studio, it started prompting for all sorts of updates. Followed the bouncing-ball and then I was able to reach my USB tethered device.

Hopefully, this is helpful for Build Master and DevOps as a "got-cha" to avoid.

Solution 19 - Android

None of the answers here worked, I had to:

  1. Close android studio
  2. rm -rf ./android/.idea
  3. Build -> Build Bundle/APK(s) -> Build APK(s)

Solution 20 - Android

The path may be invalid, if Android Studio is pointing to the wrong version of the file. This can happen if you make gradle automatically rename your built APK, using setProperty(), like:

defaultConfig {
    applicationId "com.company.app"
    versionName "1.2.0"
    // Rename the built apk file
    setProperty("archivesBaseName", "MyApp-$versionName")
    ...
}

Sometimes, an updated versionName is not properly "refreshed" to Android Studio, so it can point to an old versionName in the file name. In this case, just do a Gradle sync then Build, to ensure the versionName matches the built file path. Gradle sync is either:

  • Android Studio 4.x ➔ Toolbar at the far right ➔ Press the 'elephant + down arrow' icon, which has the tooltip "Sync Project with Gradle Files"Build ➔ Make Project

Android Studio toolbar - Button: Sync Project with Gradle Files

  • Android Studio 4.x ➔ HelpFind Action ➔ search for "sync" ➔ "Sync Project with Gradle Files"Build ➔ Make Project

Solution 21 - Android

If none of those solutions work for you just close the Android Studio and open it. It worked for me on Mac.

Solution 22 - Android

Try cleaning the project and rebuild, if doesn't work try disabling the Instant Run from Settings>Build>Instant Run in case you are running someone else's code.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBharat Kumar EmaniView Question on Stackoverflow
Solution 1 - AndroidNoNameView Answer on Stackoverflow
Solution 2 - AndroidBharat Kumar EmaniView Answer on Stackoverflow
Solution 3 - AndroidfazilView Answer on Stackoverflow
Solution 4 - AndroidMdehView Answer on Stackoverflow
Solution 5 - AndroidMohammad Naim DaheeView Answer on Stackoverflow
Solution 6 - AndroidMichael MartinView Answer on Stackoverflow
Solution 7 - Androiddev_mg99View Answer on Stackoverflow
Solution 8 - AndroidMalek HijaziView Answer on Stackoverflow
Solution 9 - AndroidSaif HakeemView Answer on Stackoverflow
Solution 10 - AndroidHanView Answer on Stackoverflow
Solution 11 - AndroidShahadat HossainView Answer on Stackoverflow
Solution 12 - AndroidLeonid IvankinView Answer on Stackoverflow
Solution 13 - AndroidHossam GamalView Answer on Stackoverflow
Solution 14 - AndroidVahidView Answer on Stackoverflow
Solution 15 - AndroidSunder NegiView Answer on Stackoverflow
Solution 16 - AndroidFathurrahman AminView Answer on Stackoverflow
Solution 17 - AndroidDevansh MauryaView Answer on Stackoverflow
Solution 18 - AndroidmobibobView Answer on Stackoverflow
Solution 19 - AndroidComputer's GuyView Answer on Stackoverflow
Solution 20 - AndroidMr-IDEView Answer on Stackoverflow
Solution 21 - AndroidShahrear Bin AminView Answer on Stackoverflow
Solution 22 - AndroidDevView Answer on Stackoverflow