DEV Community

Yash Chavan
Yash Chavan

Posted on

Need help - Build Failure: java.util.zip.ZipException: zip END header not found in React Native Project

Hi React Native Community,

I’m encountering a build failure in my React Native project, and I’m hoping someone can help me troubleshoot this issue. The project was working fine yesterday, but today, when I tried to clean the project using ./gradlew clean, I ran into the following error:

**FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where:
    Settings file '/home/Myprojectupgraded/MobileAppNew/Myproject/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@1474b5af 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 472ms**

What I’ve Tried So Far:
Clearing Gradle Cache: I tried deleting the .gradle folder in my home directory and rebuilding the project, but the issue persists.

Reinstalling Dependencies: I ran npm install and ./gradlew clean again, but the error remains.

Checking Network Connection: I ensured that my internet connection is stable, as sometimes network issues can cause problems with downloading dependencies.

Updating Gradle and Plugins: I checked if there were any updates to Gradle or the React Native Gradle plugin, but everything seems up to date.

Environment:
React Native Version: 0.75.3

Gradle Version: 8.8

Operating System: linux

Top comments (1)

Collapse
 
anuragharod profile image
Anurag Harod

I follow this steps to solve android gradle issue

  • Install the library "@react-native/gradle-plugin"
  • In gradle.properties file replace "MaxPermSize" with "MaxMetaspaceSize"
  • In gradle-wrapper.properities file Upgrade to gradle zip 8.9 distributionUrl=services.gradle.org/distributions/...
  • After completing above steps, just do the gradle clean and re run the app.