Updated android and gradle now getting error "Execution failed for task ':app:compileDebugJavaWithJavac' - android

I just updated android studio and the gradle, but now when i try running the app i get the following error:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not open local jar classpath snapshot write cache (C:\Users\Richi\Documents\Android Studio Project\AppMaster\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localJarClasspathSnapshot).
> Unexpected lock protocol found in lock file. Expected 3, found 0.
not sure whats going on!!

Delete the .gradle folder and restart android studio.

Related

Unable to run application while build app in react native android (Error : Execution failed for task ':app:processDebugResources'.)

Unable to run app on react native for development , build failed on execution 91% and showing below error attached in screenshot and also attached android/build.gradle.
The dependency file might be corrupted, delete the cache under the below directory and build again. Then gradle will pull deleted dependency again from maven repository.
c:\Users\saqib.gradle\caches\transforms-2\files-2.1\7935...

Building android build with jenkins

I am trying to build android with Jenkin. But I am getting this compilation error:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
AAPT: C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\android_build\app\build\intermediates\res\merged\debug: error: The system cannot find the file specified. (2).
Can anyone else facing this issue. I tried running the build on Android Studio and it works fine. I have defined the sdk path in jenkins and setup gradle also.
Please help.
So I found a solution that worked for me. I was using jenkins:2.277.4, I downgraded the jenkin version to 2.204.6 and suddenly it worked. Also I used war file this time so the path to workspace was smaller as compared to previous install and yeah also use app:build as task for build so you dont get lint error for other libraries.

Error:Execution failed for task ':app:mergeDebugResources'. > Error: java.io.FileNotFoundException:

Error: java.io.FileNotFoundException: \app\build\intermediates\res\merged\debug\drawable-mdpi-v4\abc_ic_star_black_48dp.png (The requested operation cannot be performed on a file with a user-mapped section open)
trying to build project but file name changes all the time, error remain same
Just open this(app\build\intermediates\res\merged\debug\drawable-mdpi-v4\abc_ic_star_black_48dp.png) file directory and delete it.
Clean and Re-build your project.
Hope this will help you.
The Android Gradle plugin version 2.2.2 has an issue.
To resolve this issue you need to change your gradle plugin version in project setting:
classpath 'com.android.tools.build:gradle:2.1.3'
Just delete build folder in app then clean & rebuild project that works fine.

Error building in Android Studio

I am new to Android Studio. But after updating my Android Studio to the latest version everything works fine, but when I decide to run the app I get this error:
(Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\collinluvpc.gradle\caches\2.14.1\classAnalysis\cache.properties (The system cannot find the file specified))
I have tried to invalidate cache and restart but nothing seems to work. Please help.
At first Upgrade SDK Manager .
(Error:Execution failed for task ':app:compileDebugJavaWithJavac'. java.io.FileNotFoundException: C:\Users\collinluvpc.gradle\caches\2.14.1\classAnalysis\cache.properties (The system cannot find the file specified))
This exception is thrown during a failed attempt to open the file denoted by a specified pathname.
What is your classpath ??
You can use
compile 'com.google.android.gms:play-services:current_version'
& Use this
classpath 'com.android.tools.build:gradle:current_version'
Then Clean-Rebuild Your Project .
Go to File > Settings > Build Tools > Gradle > Configure "Gradle User Home to" -> user/.android/.gradle

Execution failed for task ':app:mockableAndroidJar'

I am using local gradle of version 2.4 and IntelliJ IDEA 14.1.3
When I run project from IntelliJ it runs fine but when execute gradle clean build command from command line it gives the flowing exception and build fails.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mockableAndroidJar'.
> java.util.zip.ZipException: invalid entry compressed size (expected 2051 but got 2050 bytes)
This looks like an old ques which is not yet answered yet.
I got into same problem, when my jar files could not be read by Android Studio and it gave me the above mentioned error.
Taking lead from the comment by -Mikhail Boyarsky I changed classpath in build.gradle file to 'com.android.tools.build:gradle:2.2.3'.
Synced project and it started working.
I solved it by changing com.android.tools.build:gradle:2.3.0 version to 2.2.3, then build it with another exception and then I changed the version back to 2.3.0.
Not sure how it works, looks like a gradle bug.

Categories

Resources