React-Native-CLI & Android : 应用启动失败。确保您已设置 Android 开发环境

React-Native-CLI & Android :Failed to start the app. Make sure you have the Android development environment set up

我无法 运行 将现有的 react-native-cli 应用程序添加到我的 android 设备中。 iOS 模拟器发生了类似的事情,但我设法解决了它。 所以现在我只能 运行 变成 iOS 而不是 android。请查看错误消息并告诉我该怎么做。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.banana.apple signatures do not match previously installed version; ignoring!

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

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Unable to install C:\Users\Admin\Desktop\Materials\Source Code\PunreachAPP\android\app\build\outputs\apk\debug\app-debug.apk

您之前必须使用不同的版本代码和版本名称安装过该应用程序(可能来自 Play 商店)。 因此,为了构建和 运行 应用程序,您需要卸载之前安装的应用程序包 ID

com.banana.apple

您可以通过两种方式完成此操作:

  1. 像您设备上的任何其他应用程序一样手动卸载
  2. 运行 通过 USB () 连接 phone 时执行以下命令。

adb uninstall "com.banana.apple"