Así que he tenido algunos problemas con el lanzamiento del proyecto de plantilla de reacción nativa inicial en Android. Y después de consultar a alguien, me dijeron que jdk 17 no es compatible. Pero realmente no quiero bajar de categoría, ya que esto podría romper otras cosas que ya tengo y con las que trabajo. Para ser específicos, este es el error que obtengo:
> Task :app:processDebugMainManifest FAILED 11 actionable tasks: 2 executed, 9 up-to-date FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugMainManifest'. > Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @7ec6bc9b * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 20s error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 * What went wrong: Execution failed for task ':app:processDebugMainManifest'. > Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @7ec6bc9b * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 20s at makeError (C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:174:9) at C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:278:16 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async runOnAllDevices (C:\Users\karti\Desktop\ShoppingList\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid at async Command.handleAction (C:\Users\karti\Desktop\ShoppingList\node_modules\@react-native-community\cli\build\index.js:192:9)
Ya he mirado esto y nada funcionó. Gradle: la ejecución falló para la tarea ':processDebugManifest'
Para saber si se trata de un problema relacionado con la versión de Java, debe verificar su versión de Gradle.
Actualmente, solo la versión 7.3 de Gradle es compatible con Java 17.
Puede verificar la matriz de compatibilidad de gradle para verificar.
puede verificar su versión con la línea de comando escribiendo gradlew.bat -version
Si su Gradle es la versión 7.3, entonces no tiene nada que ver con la versión JDK.
Así que resolví este problema instalando JDK 16 en mi sistema y todo se resolvió y funcionó bien. No sé si el problema fue con Gradle o JDK o react-native, pero espero que en el futuro se admita jdk 17.
Si tiene el mismo problema, puede ir a: jdk 16
1) Descargue e instale el JDK 16.
2) Agregue la ruta a su jdk en la RUTA en la variable de entorno de su sistema.
3) Abra cmd y haga java -version
, debería ver algo como
java version "16.0.2" 2021-07-20 Java(TM) SE Runtime Environment (build 16.0.2+7-67) Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)