You might have got the Execution failed for task ‘:app:processDebugMainManifest’ error while trying to build a React Native project in Android. This error might also occur after adding certain packages or modules.
processDebugMainManifest React Native Error Snippet:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
How to Fix app:processDebugMainManifest Error in React Native
The solution to the Execution failed for task :app:processDebugMainManifest’ in React Native Android project for JDK 16, 17, and above is to add the following line in the ./android/gradle.properties
file in your project:
org.gradle.jvmargs=--add-opens java.base/java.io=ALL-UNNAMED
The line above stops existing Gradle instances if some are already running, and the easiest way to do that would be to restart your OS.
Also, you can try cleaning your Gradle file by:
How to Clean & Fix Gradle file in React Native Android
Open a command prompt terminal in the project file directory and run the following command:
cd android && gradlew clean
cd ..
npx react-native start
The command above will go to the android folder and clean the gradlew file, then goes back to the main directory and starts the react-native server.