Reputation: 3434
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 .
Upvotes: 184
Views: 162696
Reputation: 241
The solution that worked for me was:
1 -> Build -> Clean Project.
2 -> Build -> Rebuild Project
3 -> File -> Invalidate Caches and restart.
Upvotes: 0
Reputation: 1115
If none of those solutions work for you just close the Android Studio and open it. It worked for me on Mac.
Upvotes: 0
Reputation: 7641
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:
Upvotes: 0
Reputation: 5353
None of the answers here worked, I had to:
rm -rf ./android/.idea
Upvotes: 0
Reputation: 1012
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.
Upvotes: 1
Reputation: 8794
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.
Upvotes: 0
Reputation: 543
follow some steps:
Clean Project
Rebuild Project
Invalidate Caches / Restart
Now run your project. Hope it will work.
It's work for me.
Upvotes: 5
Reputation: 939
Hopefully, this should solve your problem.
Do follow the following steps.
1. Clean your Project
2. Rebuild your project
3. Finally Build and Run your project
Upvotes: 24
Reputation: 1758
In my case , there was a single qutation '
in project directory and after removing it resolved
Upvotes: 1
Reputation: 67
Delete the Intermediate folder after then run the project is working fine actually that APK builds to another system. Go to app/build/intermediates.
Upvotes: 1
Reputation: 1155
Just follow two steps
Step 1 : Build---> Clean
Step 2 : Build--> Build APK
Hope it works. Good luck guys
Upvotes: 78
Reputation: 680
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
Upvotes: 15
Reputation: 139
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.
Upvotes: 0
Reputation: 451
I solved it this way:
Click Build tab ---> Clean Project
Click Build tab ---> Rebuild Project
Click Build tab ---> Build APK
Run.
Upvotes: 26
Reputation: 1085
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:
I've tested it two times and it worked just fine.
Upvotes: 7
Reputation: 418
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.
Upvotes: 15
Reputation: 61
Try this in gradle project
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' }
Upvotes: 1
Reputation: 4162
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:
Upvotes: 12
Reputation: 3434
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)
`
Upvotes: 102
Reputation: 53
For me it's:
Click Build tab ---> Clean Project
Rebuild Project
Build APK
Upvotes: 5
Reputation: 10324
Click Build tab ---> Clean Project
Click Build tab ---> Build APK
Run.
Upvotes: 424