react-native: Cannot run Project.afterEvaluate(Closure) when the project is already evaluated. (When upgrade 0.64.4)
Description
Hey, I’m having some issues when upgrading from react-native v0.64.2 -> v0.64.4. Below is the error message I am getting when trying to create a build or running ./gradlew clean in the android directory. Any help?
1: Task failed with an exception.
-
Where: Script ‘~/node_modules/react-native/react.gradle’ line: 360
-
What went wrong: A problem occurred evaluating script.
Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
Version
0.64.4
Output of npx react-native info
System: OS: macOS 12.6.1 CPU: (10) arm64 Apple M1 Pro Memory: 81.56 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.0.1 - ~/.nvm/versions/node/v19.0.1/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v19.0.1/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v19.0.1/bin/npm Watchman: 2022.11.14.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 Android SDK: API Levels: 29, 31, 33 Build Tools: 28.0.3, 30.0.2, 30.0.3, 31.0.0 System Images: android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.1/14B47b - /usr/bin/xcodebuild Languages: Java: 17.0.5 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.4 => 0.64.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
It started when upgrade from react-native v0.64.2 -> v0.64.4.
Snack, code example, screenshot, or link to a repository

About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 16 (4 by maintainers)
Thanks for the follow up. I’m going to close this as it’s not a React Native issue itself
No sorry. RNGP Requires 0.71.+
Hoewever, you should be fine wiht anything above 0.65+ as that
afterEvaluateblock is not needed anymore: https://github.com/facebook/react-native/blob/2642fe185f9282ef6e39619617671068f9696008/react.gradle#L361-L373As a rule of thumb, consider updating to newer versions. 0.63 is not supported anymore
Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
It was because there are some error codes in my build.gradle, after I removed it, the build worked. I used compileSdkVersion 31 & gradle 6.7 at the end.
Could you share a reproducer? This is probably caused by a library you’re importing as an empty
0.64.4project builds fine.Frankly your on a really old version of React Native, that it’s quite of a challenge to help here. Have you considered upgrading to the latest versions?
Any fix out there? Having the same issue, RN 0.64.4, and. trying to upgrade gradle to 7.4
I fixed gradle issue but i keep getting the error.