Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

erro na execução

após a etapa de utilizar o expo eject, na etapa de utilizar o npx react-native run-android acontecem erros. Ele não reconhece o emulador do android studio e não executa a cplicação. Aparece no console o seguinte:


PS C:\Users\gustavo.felix\Documents\git-e-github\react_native\orgs-cesta> npx react-native run-android
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1162 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
'"adb"' n�o � reconhecido como um comando interno       
ou externo, um programa oper�vel ou um arquivo em lotes.
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...

> Task :react-native-gradle-plugin:compileKotlin FAILED
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.
1 actionable task: 1 executed
(node:72780) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\gustavo.felix\Documents\git-e-github\react_native\orgs-cesta\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
> Failed to query the value of task ':react-native-gradle-plugin:compileKotlin' property 'compilerRunner$kotlin_gradle_plugin'.
   > Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is running on a JDK, not JRE.

* 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 15s

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
(node:72780) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\gustavo.felix\Documents\git-e-github\react_native\orgs-cesta\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
> Failed to query the value of task ':react-native-gradle-plugin:compileKotlin' property 'compilerRunner$kotlin_gradle_plugin'.
   > Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is running on a JDK, not JRE.

* 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 15s

    at makeError (C:\Users\gustavo.felix\Documents\git-e-github\react_native\orgs-cesta\node_modules\execa\index.js:174:9)
    at C:\Users\gustavo.felix\Documents\git-e-github\react_native\orgs-cesta\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (C:\Users\gustavo.felix\Documents\git-e-github\react_native\orgs-cesta\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\gustavo.felix\Documents\git-e-github\react_native\orgs-cesta\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
1 resposta
solução!

Olá, Gustavo!

Pelo que pude entender, você está enfrentando alguns erros após utilizar o comando npx react-native run-android no seu projeto React Native. O erro menciona que o emulador do Android Studio não está sendo reconhecido e a aplicação não está sendo executada corretamente.

Vamos tentar resolver esses problemas passo a passo. Primeiramente, certifique-se de que o emulador do Android Studio está configurado corretamente e funcionando corretamente. Verifique se o emulador está sendo reconhecido pelo sistema e se você consegue executá-lo manualmente antes de rodar o comando npx react-native run-android.

Além disso, o erro menciona que o Kotlin não está encontrando as ferramentas JDK necessárias na instalação do Java. Certifique-se de que você tem o JDK instalado corretamente e que o Kotlin está sendo executado em um JDK, não em um JRE.

Outra sugestão é verificar se todas as dependências do projeto estão corretamente instaladas e atualizadas. Você pode tentar executar o comando npm install ou yarn install para garantir que todas as dependências estejam atualizadas.

Se mesmo assim os erros persistirem, sugiro que você pesquise mais sobre os erros específicos que estão sendo exibidos no console e tente encontrar soluções específicas para cada um deles. Fóruns e comunidades online de desenvolvedores React Native podem ser ótimos recursos para encontrar soluções para problemas específicos.

Espero ter ajudado e bons estudos!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software