1
resposta

Erro ao dar run-android

Fiz a primeira tentative, como dito em aula, porém sem sucesso, tentei correr atras desse problema em outros videos, no stack overflow e mesmo assim não consegui. Como eu estava querendo formatar o PC à algum tempo, assim fiz, porem deu exatamente a mesma coisa quando refiz toda a aplicação Estou a 3 dias sem conseguir seguir com o projeto

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> 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 'C:\Users\Marco\Desktop\League\Projeto1\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 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> 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 'C:\Users\Marco\Desktop\League\Projeto1\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 2s

    at checkExecSyncError (child_process.js:621:11)
    at execFileSync (child_process.js:639:15)
    at runOnAllDevices (C:\Users\Marco\Desktop\League\Projeto1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
    at buildAndRun (C:\Users\Marco\Desktop\League\Projeto1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
    at C:\Users\Marco\Desktop\League\Projeto1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (C:\Users\Marco\Desktop\League\Projeto1\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)PS C:\Users\Marco\Desktop\League\Projeto1>
1 resposta

Pela descrição do erro, precisa configurar a variável de ambiente "ANDROID_HOME".

Este tutorial pode te ajudar:

https://docs.rocketseat.dev/ambiente-react-native/android/windows