java.util.zip.ZipException: zip END header not found

A problem occurred ':gradle-plugin:react-native-gradle-plugin'. java.util.zip.ZipException: zip END header not found
New
Edited by Drew Reese 13 mins ago | 
npx react-native run-android info Installing the app...

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
Where: Settings file 'D:\app4\AwesomeProject\android\settings.gradle' line: 2

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@5a0eb741 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 4s error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * Where: Settings file 'D:\app4\AwesomeProject\android\settings.gradle' line: 2 * 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@5a0eb741 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 4s. info Run CLI with --verbose flag for more details.

Any solution to this

1 Like

Some ZIP somewhere seems to be corrupt.
Did you do what the error suggests?
If not, why?
If yes, why don’t you share the additional information? Especially the --stacktrace or much better a build --scan URL.

 ./gradlew.bat build --scan

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Settings file 'D:\app4\AwesomeProject\android\settings.gradle' line: 2

* 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@6be66fbe 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.
=============================================

I tried deleting .gradle file and also uninstalling node and reinstalling and running npx react-native run-android

Also cleared cache file downloaded and added 8.8-gradle.bin file in dists

I tried everything that was online present , still error please some help :sob:

Which Gradle you are using

It seems that it is a mass issue. Everything was working perfectly till Saturday. This Monday nothing was working for my entire team without changing a single line of code.

https://scans.gradle.com/s/sf44kerxpyah4

1 Like

Gradle 8.8 any more info req

I am also facing the same issue with Gradle 8.8.

Even though you say you run with --scan you did not.

  1. I asekd for the URL that produces
  2. The build outputs still recommends running with --scan which means you did not run with it

Assuming @abhinavbakaya is your colleague, then as I already told him on the Gradle Community Slack (and your other colleague lokesh jonwal on the Kotlin Slack - you should really coordinate and not ask with multiple people on multiple way the same thing), that with even deleting the caches not helping and all people in the team being affected, it is most probably more a central problem, like a file corruption on the repository mirror. Or maybe some network tool like AntiVirus or Firewall intercepting and corrupting the file.

Error resolving plugin [id: 'com.facebook.react.settings'] · Issue #34613 · expo/expo · GitHub and Fixed : React Native App Gradle Plugin Build error -(zip END header not found) blame R/N to somehow have caused this and suggest steps to resolve it.

1 Like

Please share solution if you got

Worked for me after installing @react-native/gradle-plugin 0.77 and upgrading distributionUrl to gradle-8.9-all.zip in gradle-wrapper.properties. My project is targeting to React Native version 0.75.3

For anyone following from India here, the ministry of electronics in India caused the Kotlin Gradle Plugin URLs of 1.9.24 to be blocked.
This causes the “this is blocked” HTML page to be downloaded as jar file as the blocking is not accompanied with an according HTTP status response, which can then not be read by Gradle as jar file of course.
Update KGP version to 1.9.25 and it should work. (Until they block that too eventually)

/React Native/indoornavmobileapp/android$ ./gradlew clean --scan

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Settings file '/home/pickupbiz/Projects/React Native/indoornavmobileapp/android/settings.gradle' line: 2

* 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@8067ad6 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 736ms
pickupbiz@pickupbiz-OptiPlex-3020:~/Projects/React Native/indoornavmobileapp/android$

can you provide source please? Unable to find

Edit: Okay, found one

If you look inside the jar that is corrupt, you see that it is an html page.
If you open that in the browser, you see the message that the page was blocked on request of that ministry.