Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration Cache Incompatibility: cleanCmakeCache Task Causes "Cannot reference a Gradle script object" Error on Clean Build #7007

Open
omeratt opened this issue Feb 10, 2025 · 3 comments
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android

Comments

@omeratt
Copy link

omeratt commented Feb 10, 2025

./gradlew clean error!

I'm encountering an issue with the react-native-reanimated package that causes a build failure when Gradle's configuration cache is enabled, specifically when performing a clean build (./gradlew clean). The error message indicates an incompatibility with the way the cleanCmakeCache task is configured in the react-native-reanimated's build.gradle file.
Crucially, this issue only occurs on a clean build. Subsequent builds after the initial failure succeed.

Error Message
`Execution failed for task ':react-native-reanimated:cleanCmakeCache'.

Cannot reference a Gradle script object from a Groovy closure as these are not supported with the configuration cache.`

Image

Expected Behavior
The build should succeed with the configuration cache enabled, even on a clean build. The cleanCmakeCache task should be compatible with the configuration cache.
Observed Behavior
The build fails with the "Cannot reference a Gradle script object from a Groovy closure" error only on a clean build. This error is caused by the following line in react-native-reanimated/android/build.gradle (around line 453):
task cleanCmakeCache() { tasks.getByName("clean").dependsOn(cleanCmakeCache) doFirst { delete "${projectDir}/.cxx" // this is line 453 } }

Attempts to Resolve
I have tried several approaches to resolve this issue, but none have been successful:

Environment
Gradle: 8.8
Operating System: macOS 14.1

Request
I would greatly appreciate it if the maintainers of react-native-reanimated could investigate this issue and provide a fix that is compatible with Gradle's configuration cache, especially on clean builds.

Steps to reproduce

  1. Create a new React Native project or use an existing one.

  2. Install the react-native-reanimated package: npm install react-native-reanimated or yarn add react-native-reanimated.

  3. Enable the configuration cache in your gradle.properties file:
    org.gradle.configuration-cache=true

  4. Perform a clean build: ./gradlew clean

  5. The build will fail with the error message mentioned above.

  6. If i make a normal build: ./gradlew assembleDebug or ./gradlew assembleRelease.
    The build will succeed

Snack or a link to a repository

https://snack.expo.dev/

Reanimated version

3.15.3

React Native version

0.75.3

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Other (please specify)

Device

None

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Platform: Android This issue is specific to Android Missing repro This issue need minimum repro scenario labels Feb 10, 2025
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

Copy link

github-actions bot commented Feb 10, 2025

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Description section.

@github-actions github-actions bot added the Missing info The user didn't precise the problem enough label Feb 10, 2025
@EliranIsracard
Copy link

same issue in my project :(
can't run gradle clean, got the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android
Projects
None yet
Development

No branches or pull requests

2 participants