Android Studio error: Unexpected lock protocol found in lock file. Expected 3, found 0. Information: BUILD FAILED

1

I am working with Android Studio 2.1 and Ubunto 16 LTS. I have installed Java correctly. There is no way I can compile any project since every time I do I receive the following error:

  

Unexpected lock protocol found in lock file. Expected 3, found 0. Information: BUILD FAILED

I have already entered the environment variables, reinstalling Android Studio and nothing.

Here is the complete log:

  

Information: Gradle tasks [: app: clean,: app: generateDebugSources,: app: generateDebugAndroidTestSources,: app: mockableAndroidJar,: app: prepareDebugUnitTestDependencies,: app: assembleDebug]   : app: clean   : app: preBuild UP-TO-DATE   : app: preDebugBuild UP-TO-DATE   : app: checkDebugManifest   : app: preReleaseBuild UP-TO-DATE   : app: prepareComAndroidSupportAnimatedVectorDrawable2410Library   : app: prepareComAndroidSupportAppcompatV72410Library   : app: prepareComAndroidSupportSupportV42410Library   : app: prepareComAndroidSupportSupportVectorDrawable2410Library   : app: prepareDebugDependencies   : app: compileDebugAidl   : app: compileDebugRenderscript   : app: generateDebugBuildConfig   : app: mergeDebugShaders   : app: compileDebugShaders   : app: generateDebugAssets   : app: mergeDebugAssets   : app: generateDebugResValues UP-TO-DATE   : app: generateDebugResources   : app: mergeDebugResources   : app: processDebugManifest   : app: processDebugResources   : app: generateDebugSources   : app: preDebugAndroidTestBuild UP-TO-DATE   : app: prepareDebugAndroidTestDependencies   : app: compileDebugAndroidTestAidl   : app: processDebugAndroidTestManifest   : app: compileDebugAndroidTestRenderscript   : app: generateDebugAndroidTestBuildConfig   : app: mergeDebugAndroidTestShaders   : app: compileDebugAndroidTestShaders   : app: generateDebugAndroidTestAssets   : app: mergeDebugAndroidTestAssets   : app: generateDebugAndroidTestResValues UP-TO-DATE   : app: generateDebugAndroidTestResources   : app: mergeDebugAndroidTestResources   : app: processDebugAndroidTestResources   : app: generateDebugAndroidTestSources   : app: mockableAndroidJar UP-TO-DATE   : app: preDebugUnitTestBuild UP-TO-DATE   : app: prepareDebugUnitTestDependencies   : app: incrementalDebugJavaCompilationSafeguard   : app: compileDebugJavaWithJavac   : app: compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).   : app: compileDebugJavaWithJavac FAILED   Error: Execution failed for task ': app: compileDebugJavaWithJavac'.

     

Unexpected lock protocol found in lock file. Expected 3, found 0.   Information: BUILD FAILED   Information: Total time: 4.617 secs   Information: 1 error   Information: 0 warnings   Information: See complete output in console

I appreciate your cooperation.

    
asked by Karolyn Méndez 21.07.2016 в 17:20
source

2 answers

1

I have solved it by removing the contents of the folder ~ .gradle / caches / 2.10.

    
answered by 21.07.2016 / 18:32
source
0

I think this problem is related to some type of corruption in the folder .gradle of the project.

Therefore the solution is to delete the contents of the folder .gradle/ and restart Android Studio.

To find the location of the .gradle/ directory, we can go to the project settings, settings or preferences on MAC enter Build, Execution, Deployment > Build Tools > Gradle :

    
answered by 22.07.2016 в 05:13