I’m trying to run my React Native project using Expo (npx expo run:android), but I’m encountering a Gradle error:
FAILURE: Build failed with an exception.
* What went wrong:
Unexpected lock protocol found in lock file. Expected 3, found 50.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
What I Tried:
Updated Gradle to 8.10.2 manually by downloading it from the official site and extracting it to:
C:\Users\LENOVO\gradle-8.10.2
Modified gradle-wrapper.properties (inside android/gradle/wrapper/) to point to the local Gradle distribution:
Despite these steps, I’m still getting the “Unexpected lock protocol found in lock file. Expected 3, found 50” error. How can I resolve this issue?
I keep getting this error: Could not run phased build action using connection to Gradle distribution ‘services.gradle.org/distributions/gradle-8.10.2-all.zip’. Unexpected lock protocol found in lock file. Expected 3, found 50
Seems some file is corrupted.
Try to delete all .gradle folders you find in your project.
If you e.g. have buildSrc or included builds, they will have their own.
Please never anywhere share screenshots of text if you only want to share the text and not something additional like colors or IDE annotations. Text in images is hard to read, especially on mobile, very hard to copy, and nearly impossible to search for.
Besides that, seems there are more files corrupt, you should probably check your drive health. Try also deleting your build directories. And if that does not help, the stuff from your Gradle user home that you did not put manually there.
Sorry for that, here is the full error, tried everything deleted .gradle folder, deleted builds, created new builds using npx expo prebuild --clean nothing seems to be working.
pnpm expo run:android
env: load .env.local
env: export EXPO_PUBLIC_SUPABASE_URL EXPO_PUBLIC_SUPABASE_ANON_KEY
› Building app...
Downloading https://services.gradle.org/distributions/gradle-8.10.2-all.zip
.....................10%......................20%......................30%.....................40%......................50%......................60%......................70%.....................80%......................90%......................100%
Welcome to Gradle 8.10.2!
Here are the highlights of this release:
- Support for Java 23
- Faster configuration cache
- Better configuration cache reports
For more details see https://docs.gradle.org/8.10.2/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration on demand is an incubating feature.
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Settings file 'C:\frontend\mobile\hoodwinked-app\android\settings.gradle' line: 4
* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
> java.util.zip.ZipException: zip END header not found
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
> Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@1f51067 of type BuildFlowService.Parameters
> A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
> java.util.zip.ZipException: zip END header not found
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
BUILD FAILED in 1m 36s
Error: C:\frontend\mobile\hoodwinked-app\android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1
Error: C:\frontend\mobile\hoodwinked-app\android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1
at ChildProcess.completionListener (C:\frontend\mobile\hoodwinked-app\node_modules\@expo\spawn-async\src\spawnAsync.ts:67:13)
at Object.onceWrapper (node:events:639:26)
at ChildProcess.emit (node:events:524:28)
at ChildProcess.cp.emit (C:\frontend\mobile\hoodwinked-app\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1101:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
...
at spawnAsync (C:\frontend\mobile\hoodwinked-app\node_modules\@expo\spawn-async\src\spawnAsync.ts:28:21)
at spawnGradleAsync (C:\frontend\mobile\hoodwinked-app\node_modules\@expo\cli\src\start\platforms\android\gradle.ts:134:28)
at assembleAsync (C:\frontend\mobile\hoodwinked-app\node_modules\@expo\cli\src\start\platforms\android\gradle.ts:83:16)
at runAndroidAsync (C:\frontend\mobile\hoodwinked-app\node_modules\@expo\cli\src\run\android\runAndroidAsync.ts:48:24)