'Problem with Gradle versions and Android Emulator

I'm new to using React and have been following along in a tutorial for a project to learn. Occasionally, I encounter an error that stops my progress, then I search the error, and I generally find some solution. But in this case, I am having a hell of a time. Part of the issue is that I am so new to developing software that I sometimes am unsure of how to implement someone's solution. And, in particular, this issue seems like it is not simply contained to a single project, which means that new projects I create with React are now also experiencing similar issues.

Here's the issue. When I use npm run android, I get the following output:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1940 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Launching emulator...
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...

> Configure project :react-native-reanimated
> No AAR for react-native-reanimated found. Attempting to build from source.
> Native libs debug enabled: false
> Android gradle plugin: 4.2.2
> Gradle: 7.2
> building Reanimated2

> Task :app:generatePackageList FAILED

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.2/userguide/command_line_interface.html#sec:command_line_warnings
10 actionable tasks: 3 executed, 7 up-to-date

FAILURE: Build failed with an exception.

* Where:
  Script 'C:\\Users\\Astuertz\\Dev\\Values2\\node_modules@react-native-community\\cli-platform-android\\native_modules.gradle' line: 122

* What went wrong:
  Execution failed for task ':app:generatePackageList'.

> argument type mismatch

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

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.

* Where:
  Script 'C:\\Users\\Astuertz\\Dev\\Values2\\node_modules@react-native-community\\cli-platform-android\\native_modules.gradle' line: 122

* What went wrong:
  Execution failed for task ':app:generatePackageList'.

> argument type mismatch

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

    at checkExecSyncError (node:child_process:828:11)
    at execFileSync (node:child_process:866:15)
    at runOnAllDevices (C:\Users\Astuertz\Dev\Values2\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
    at async Command.handleAction (C:\Users\Astuertz\Dev\Values2\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:182:9)

Someone had said that Gradle version 7 is incompatible with the current version of React and that it needs to be downgrade to version 7. I tried changing the version in the wrapper file for the Android folder, as well as taking someone's suggestion to change it in the Android Studio "Project Structure." In either case, the error either persisted or merely gave me a different error. What is going on here?

I've been trying to get my apps to run and compile but am in over my head.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source