从物理设备上卸载 React-Naitve 项目后如何安装它

问题描述

我最近卸载了react native项目,在物理设备中重建项目。

Installing APK 'app-debug.apk' on 'ZenFone Max Pro M1 - 10' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL in 26s
167 actionable tasks: 2 executed,165 up-to-date
info Connecting to the development server...
info Starting the app on "C4ATAS000000"...

但它不会初始化项目。显示错误后。

Starting: Intent { cmp=com.newproject/.MainActivity }
Error type 3
Error: Activity class {com.newproject/com.newproject.MainActivity} does not exist.
Done in 37.23s.

我应该怎么做才能在物理设备中重新安装它。 提前致谢

解决方法

这是有时会发生的常见错误,请尝试使用以下可能对您有所帮助的命令

  • 卸载旧应用
  • 打开项目然后打开终端
  • cd 安卓
  • ./gradlew 干净
  • cd ..
  • npx react-native run-android