Cannot run Project.afterEvaluate(Closure) when the project is already evaluated. (When upgrade 0.64.4)

See original GitHub issue

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

Screen Shot 2022-11-17 at 16 35 51

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:4
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
cortinicocommented, Nov 25, 2022

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.

Thanks for the follow up. I’m going to close this as it’s not a React Native issue itself

1reaction
CYCkencommented, Nov 24, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flutter Cannot run Project.afterEvaluate(Closure) when the ...
After upgrading Flutter version from 2.8.1 to 2.10, I started getting the following error. I reinstalled Flutter but the result did not change....
Read more >
Gradle 7 fails with "Cannot run Project.afterEvaluate(Action ...
Cannot run Project.afterEvaluate(Action) when the project is already evaluated. The line in question, 446, is apply plugin: 'maven-publish'.
Read more >
Executing code with Project.afterEvaluate() after project is ...
The only workaround I found to make sure my thing gets executed is to check ProjectInternal.getState().executed() and call afterEvaluate() or action.execute() ...
Read more >
Prerequisites for Applications - React Native
x and Android Gradle Plugin 7.x; Using the new React Gradle Plugin; Building react-native from Source. You can update Gradle by running:.
Read more >
Flutter Cannot run Project.afterEvaluate(Closure) when the ...
Coding example for the question Flutter Cannot run Project.afterEvaluate(Closure) when the project is already evaluated-Flutter.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found