Reputation: 46
I'm encountering a Gradle build error while working on my React Native project. The error message is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
java.io.UncheckedIOException: java.util.zip.ZipException: zip END header not found
java.util.zip.ZipException: zip END header not found
org.gradle.internal.snapshot.impl.IsolationException: Could not isolate value
org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@dff515a of type BuildFlowService.Parameters
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':gradle-plugin:react-native-gradle-plugin'.
java.io.UncheckedIOException: java.util.zip.ZipException: zip END header not found
java.util.zip.ZipException: zip END header not found
Despite these attempts, the issue persists. Has anyone faced a similar issue? Any suggestions on how to fix this?
Upvotes: 2
Views: 499
Reputation: 17554
This issue happens because of Kotlin version 1.9.24
.
There are two solutions for this.
Upgrade React Native
to version 0.77
, as it depends on Kotlin 2.x ( which is not affected )
Use patch-package
to update the Kotlin version here node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml
, change kotlin = "1.9.24"
to kotlin = "1.9.25"
[versions]
agp = "8.5.0"
gson = "2.8.9"
guava = "31.0.1-jre"
javapoet = "1.13.0"
junit = "4.13.2"
kotlin = "1.9.25"
assertj = "3.25.1"
To set a package-patch
, you can check this video
Upvotes: 1
Reputation: 21
I was facing a similar issue in my Expo project. I updated my React Native version to "react-native": "0.76.7"
and ran npx expo install expo@latest
. This resolved the problem for me.
Upvotes: 2
Reputation: 227
I faced similiar kind of issue I was using react native 0.76.* version so I upgraded it to 0.77.0 Firstly I have removed the node_modules and yarn.lock (if you are using npm then please remove package-lock.json) and removed the .gradle from android folder and the try to re-install the packages And try to run the app, It should work.
Upvotes: 1