Projects continuously fails to clean because of fail to delete file - android

I have browsed several topics surrounding this subject but none are quite recent and maybe someone else can help me. If I clean my project or even try to rebuild it a continuously get an error that says
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:clean'.
> Unable to delete directory 'K:\Android\DementiaApp\app\build'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder\debug\0\com\example\seansandroid\myApp\Games
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder\debug\0\com\example\seansandroid\myApp
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder\debug\0\com\example\seansandroid
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder\debug\0\com\example
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder\debug\0\com
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder\debug\0
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder\debug
- K:\Android\DementiaApp\app\build\intermediates\transforms\dexBuilder
- K:\Android\DementiaApp\app\build\intermediates\transforms
- K:\Android\DementiaApp\app\build\intermediates
The file in question is the intermediates. I have seen a lot of people say that you just need to delete this file. For some reason, even if I try to delete the intermediates, they just wont delete! Can anyone help me? This is really annoying.

I'll post the solution to my own question because its worked for me and may help others in the future.
No matter what, my file would not allow me to delete it, regardless of administrative privileges.
By renaming the file, Android Studio identified the file as 'missing' and regenerated another build file. This then allowed me to rebuild and clean my project.
It now works again!

Related

Updating created problems with Gradle

this is my very first post, Big Deal to me, appreciate your help Colleagues.
I recently updated Android Studio, (this is why I don't like updating) it forced me to create a new gradle file it called Hello ESE.gradle (ESE being the Company's name), the file simple contains this :
group = "itet"
version = "1"
the updating placed this file in the res/values directory when I built, this caused an error saying the file needed to end in .xml,
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
/Users/lokeke/AndroidStudioProjects/CalorieCountdownAppforAndroidBrown/app/src/main/res/values/Hello ESE.gradle: Error: The file name must end with .xml
I thought a gradle does not belong in the values directory so I removed it and put in the build directory but now the errors are even worse, I moved this Hello ESE.gradle to other places where gradle could look for it but still nothing works it won't build, don't know what to do now (how I wish I could go back to pre-update!!!)
I just simply updated all the tools I was using, Gradle, SDK, the works, and transferred to the Hello gradle file to the gradle.properties directory, this seems to have fixed it.

Build error related to Jar file in Flutter

I am working on flutter and trying to include map_view in my app. But I have a build error as:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':map_view:androidApis'.
> Failed to transform file 'android.jar' to match attributes {artifactType=android-platform-attr} using transform PlatformAttrTransform
> java.io.FileNotFoundException: C:\Users\Harsh Goyal\AppData\Local\Android\sdk\platforms\android-27\android.jar (The system cannot find the file specified)
It seems to be related to some missing file. I dont know what to do and can't find any solutions!
Any help is appreciated. :)
I just reinstalled my Android SDK and everything worked perfectly. An answer was posted on a github issue where I posted this question. Here is the link in case it is required:
https://github.com/apptreesoftware/flutter_google_map_view/issues/129#issuecomment-500956688
android.jar file must be broken or missing.
Download and paste .jar file from https://github.com/Sable/android-platforms according to your api level.
Usually you don't need to restart. If doesn't works, restart and retry

Execution failed for task dexBuilderForDebug

I’ve got big nasty error message recently when trying to build app. This happened after Windows crash (Insider build, ha ha).
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: java.io.IOException: java.util.concurrent.ExecutionException: java.io.UncheckedIOException: java.io.IOException: The file or directory is corrupted and unreadable
Here is full Gradle console output: https://pastebin.com/ri58vYN7
What I already tried:
Delete /.gradle directory
Delete app/build directory
Invalidate caches / restart
Clean project, rebuild project
What can I do about it? Is the only way to start new project?
The crash should be a good sign for you to start learning and using a version control like git and start using Linux.
Usually, after Windows crash, one or more of your files in your project got corrupted. Sometimes the file becomes blank or contains cryptic text which the Gradle can't read and process. You need to check each file inside your project and fix it.
You must cherish the problems because it happens when you starting a new project. Start using version control or you will lost your precious time and project when Windows crash again.
Afaik, crash is a feature of Windows.

Android - Build fails with exception

I am building a project for quite a while and my friend recently started working on it as well. We are using github, we integrated it into android studio and everything seemed to be fine. However, after his first push, my build broke.
FAILURE: Build failed with an exception.
What went wrong:
failed for task ':app:compileDebugJavaWithJavac'.>java.io.FileNotFoundException:C:\Users\user\.gradle\caches\2.10\classAnalysis\cache.properties (System cannot find the given file)
I looked at other StackOverflow threads as well, but none of the fixes worked for me. Any ideas? Tell me what to include, I ll include in comments.
Thank you in advance :)
I had this same problem and I was able to find a resolution from
Cache.properties (The system cannot find the file specified)
Use the File manager and navigate to the 2.10 folder, You will then want to copy the classAnalysis folder and paste it somewhere safe (I pasted mine into the folder up from 2.10, the caches folder). Once its in a safe place delete the version of it inside the 2.10 folder. Then go to android studio and click Build>Make Project. It should regenerate that folder. For me after it generated it I had the same error in the jarSnapshots folder. Did the same thing again and it worked out for me.

Blocked with Android studio compilation issue ManifestMerger2$MergeFailureException

With Android studio v0.8.2, I am blocked with the following exception. With the beta release it was working very well. I have updated my IDE to 0.8.2 and deleted my target directory and trying to build again. I am struck now.
Execution failed for task ':app:processDebugManifest'.
com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: /home/gopinath/code/bitbucket/android/productionapp/build/intermediates/exploded-aar/com.jakewharton.hugo/hugo-runtime/1.1.0/AndroidManifest.xml (No such file or directory)
As reported by the error, the file is actually missing in the mentioned path. For my other project in which I have hugo-runtime, the file exists and compilation is proper.
Is anyone else facing this issue? Is there a workaround for this?
Click the build tab and clean Project. Boom!
Posting so that it might help others:
I ran into this issue as well. The error is from ManifestMerger and it made me believe it has something to do with my manifest file and that took me on a wrong path. This error can also happen in case of an invalid XML file in your resources. In my case it was a layout file that got left over from a merge conflict with nothing in it (an empty layout file) which in turn caused the issue. it also cloud be any other xml file so I would suggest opening your xml resources one at a time and see if there is any error in them (you will get the lint error when opening the file)

Categories

Resources