Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se
Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Problemas durante execução do projeto React Native

Ao executar o comando npx React-native run-android

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where: Build file 'D:\Desenvolvimento\workspace_vscode\Lighteria\node_modules\react-native-navigation\lib\android\app\build.gradle' line: 5

  • What went wrong: A problem occurred evaluating project ':react-native-navigation'.

    Plugin with id 'kotlin-android' not found.

  • 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.

2: Task failed with an exception.

  • What went wrong: A problem occurred configuring project ':react-native-navigation'.

    compileSdkVersion is not specified.

  • 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 4s

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 completed with 2 failures.

1: Task failed with an exception.

  • Where: Build file 'D:\Desenvolvimento\workspace_vscode\Lighteria\node_modules\react-native-navigation\lib\android\app\build.gradle' line: 5

  • What went wrong: A problem occurred evaluating project ':react-native-navigation'.

    Plugin with id 'kotlin-android' not found.

  • 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.

2: Task failed with an exception.

  • What went wrong: A problem occurred configuring project ':react-native-navigation'.

    compileSdkVersion is not specified.

  • 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 4s

at checkExecSyncError (child_process.js:643:11)
at execFileSync (child_process.js:661:15)
at runOnAllDevices (D:\Desenvolvimento\workspace_vscode\Lighteria\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (D:\Desenvolvimento\workspace_vscode\Lighteria\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at D:\Desenvolvimento\workspace_vscode\Lighteria\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Command.handleAction (D:\Desenvolvimento\workspace_vscode\Lighteria\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)

A versão do Gradle é a 7.1.1

1 resposta
solução!

Descobri o problema e o mesmo já foi resolvido. Inicialmente, pelo log de erro, achei que o problema estava no gradle, mas na verdade estava na instalação do react native. A instalação global (npm install -g react-native) estava causando conflito com alguma coisa. Enfim, removi o react native (npm uninstall -g react-native) e após isso, executei o comando npx react-native run-android, com isso, antes de executar o projeto no android, o mesmo validou que o react native não estava instalado e efetuou a instalação dos pacotes. Agora esta funcionando que é uma beleza, e bem mais performático que antes do problema.

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