react-native - React-Native-CLI & Android : 启动应用失败。确保您已设置 Android 开发环境
问题描述
我无法在我的 android 设备中运行现有的 react-native-cli 应用程序。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
您可以通过 2 种方式执行此操作:
- 像从您的设备上一样手动卸载任何其他应用程序
- 通过 USB ( source )连接手机时运行以下命令。
adb 卸载“com.banana.apple”
推荐阅读
- npm - 如何在创建新的 Angular 8 项目时修复此 json 错误
- java - Drools 在 camelCase 中查找 Java 类,引发 NoClassDefFoundError
- c++ - C ++管理大量图像缓冲区
- objective-c - 为什么 setTitleEdgeInsets 在 iOS 13 中不起作用?目标 - C
- uno-platform - GetFileFromApplicationUriAsync、CopyAsync、AsStreamForRead 未在 Uno 平台中实现。解决方法?
- php - 如何以编程方式更新 Prestashop 产品状态?
- ubuntu - 如何指定用户定义的存档目录以运行“apt install ./
" - c - 它在 C 中是如何工作的?(实现 strcat 函数)
- java - Java 编译器是否存在“赋值无效”警告/错误的错误
- angular - 如何使用 [routerLink] 导航到 html id