
Juanito Ortega Guzmán
PreguntaEstoy estancado aquí… tengo instalado Android Studio, tengo el emulador de Android 11.
Pero tengo esto en consola cuando intento correr la App para ver el Hello Wordl.
(base) jortega@Juanitos-MacBook-Pro storeapp % npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 870 file(s) to forward-jetify. Using 4 workers... info Starting JS server... /bin/sh: adb: command not found info Launching emulator... error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app... Starting a Gradle Daemon (subsequent builds will be faster) FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/android/local.properties'. * 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 16s

Lucio Negrello
Uffff, que complicado que resultó. Me alegro que haya quedado todo resuelto y funcionando. A seguir avanzando!! Saludos!

Juanito Ortega Guzmán
Después de ejecutar varios comandos en mi Terminal, la rompí y al final tenía un bucle infinito, en fín, formatee todo mi equipo. Después de revisar cada parte, ya pude levantar todo bien. Gracias Lucio.

Juanito Ortega Guzmán
Pensé en lo mismo y ejecuté ese comando... pero igual tengo el mismo error... 😬. Tendrías 5 min para ayudarme mañana por favor?

Lucio Negrello
Hola Juanito, cómo estás? El problema actual es que no está identificando el JDK de Java, por ende no puede compilar. En este link te dice que tenés que instalarla con Brew en mac.
brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
Entiendo que con ese comando debería quedar correctamente instalada. No enloquezcas, jaja. Saludos!

Juanito Ortega Guzmán
Hola profesor Lucio, gracias por la ayuda. Ya edité correctamente mi archivo .zshrc con las variables necesarias. Ahora el emulador se lanza bien, pero al momento de instalar la App genera errores que no entiendo como solucionar. Este es mi último registro de errores:
(base) jortega@Juanitos-MacBook-Pro storeapp % npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 870 file(s) to forward-jetify. Using 4 workers... info Starting JS server... info Launching emulator... info Successfully launched emulator. info Installing the app... > Task :app:compileDebugJavaWithJavac FAILED 15 actionable tasks: 2 executed, 13 up-to-date FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation. * 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 7s 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 app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation. * 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 7s at makeError (/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9) at /Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async runOnAllDevices (/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5) at async Command.handleAction (/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli/build/index.js:192:9) info Run CLI with --verbose flag for more details. (base) jortega@Juanitos-MacBook-Pro storeapp %
Estoy al borde de la locura, tengo un Mac con Big Sur

Lucio Negrello
Hola Juanito, cómo te decía, si estás usando ZSH, el archivo a modificar para cargar las variables no es
.bash_profile
.zshrc
Hola Mundo

Juanito Ortega Guzmán
Ya tengo la versión de mi shell (ZSH)... vuelvo a probar... y confirmo... gracias

Juanito Ortega Guzmán
Hola profesor... gracias por la ayuda brindada, se aprecia mucho, eres de los pocos profesores que ayudan en su curso.
En fin, te cuento que estoy con un equipo Mac con Big Sur, como puedo saber que tipo de Shell uso?... siempre uso la terminal que viene por defecto. Te cuento que muy momentáneamente me lanzó el emulador de Android, pero no logré ver el Hola mundo, pero después ya no puede lograr otra vez que se lanzara el emulador. Tengo que seguir buscando la solución... probaré con los nuevos tips que me diste. Tenía mucho entusiasmo de este curso, sin embargo, me frustré mucho que no haya podido ni llegar al Hola mundo en el emulador. Probaré otra vez... gracias.

Lucio Negrello
Hola Juanito, cómo estás?
Googlié el error y encontré esta solución en StackOverflow. Otra alternativa que se me ocurre es que estés utilizando otra shell. Por ejemplo si estás utilizando ZSH el archivo a modificar es
.zshrc
Como explico en la clase de preparación del proyecto, justamente por las particularidades que tiene el entorno de desarrollo para App Mobile, es que se recomienda seguir los pasos de la web de React Native y revisar caso por caso si hay problemas porque es muy variable de un equipo a otro. En muchos casos varía del shell que uses, de las dependencias del sistema, etc.
Otra opción es utilizar Expo para el entorno. En el Curso de Introducción de React Native, entiendo que el profe explica cómo instalarlo y utilizarlo en los diferentes sistemas.
Espero que con esta info, resolver el problema. Quedo atento por cualquier otra duda. Saludos!

Juanito Ortega Guzmán
Hola profesor. Añadí las variables de entorno a mi archivo .bash_profile. Lanzo mi emulador Ejecuto
npx react-native run-android
Por favor ayuda, no se explica bien el paso a paso para preparar bien el entorno de desarrollo, es como si se asumiera que uno ya tiene el entorno listo.
Soy nuevo intentando crear una app con react native.
Así tengo mi archivo .bash_profile.
(base) jortega@Juanitos-MacBook-Pro storeapp % npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 870 file(s) to forward-jetify. Using 4 workers... info Starting JS server... /bin/sh: adb: command not found info Launching emulator... error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app... Starting a Gradle Daemon (subsequent builds will be faster) FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/android/local.properties'. * 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 35s 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 app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/android/local.properties'. * 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 35s at makeError (/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9) at /Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async runOnAllDevices (/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5) at async Command.handleAction (/Users/jortega/Cursos/Platzi/WordPress/app-woocommerce/storeapp/node_modules/@react-native-community/cli/build/index.js:192:9) info Run CLI with --verbose flag for more details.
Por favor algun otro tip? Gracias...