react-native run-android 部署旧版本

标签 react-native

我正在构建一个 react native android 应用程序。我使用 Windows 作为我的开发区域。要将我的应用程序推送到我的手机,我只需通过 USB 将手机连接到我的电脑,然后运行命令 react-native run-android

这在我的一部安卓手机上运行良好,完全符合预期。

我有第二部较旧的 Android 手机,但每次我运行 react-native run-android 时,它都会收到 2-3 天前的旧版应用程序,当时我上次将​​手机连接到电脑。我尝试从我的手机上手动卸载该应用程序,我尝试重新启动我的手机,我尝试取出电池,但每次部署时,它仍然收到旧版本。

如何让我的第二部安卓手机接收最新版本?

最佳答案

如果你看看他们的 documentation , Reload JS 仅适用于 Android 5 及更高版本的 USB 调试。对于旧设备,您可能想尝试方法 2:

Method 2: Connect via Wi-Fi

You can also connect to the development server over Wi-Fi. You'll first need to install the app on your device using a USB cable, but once that has been done you can debug wirelessly by following these instructions. You'll need your development machine's current IP address before proceeding.

Open a terminal and type /sbin/ifconfig to find your machine's IP address.

Make sure your laptop and your phone are on the same Wi-Fi network. Open your React Native app on your device. You'll see a red screen with an error. This is OK. The following steps will fix that. Open the in-app Developer menu. Go to Dev Settings → Debug server host for device. Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081). Go back to the Developer menu and select Reload JS.

You can now enable Live reloading from the Developer menu. Your app will reload whenever your JavaScript code has changed.

关于react-native run-android 部署旧版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46627138/

相关文章:

javascript - 什么是最佳实践导航 react native

react-native - Atom/Nuclide 是否为 react-native 组件提供自动导入

reactjs - 如何在 VSCode 的 .js 文件中注释掉 JSX 代码?

javascript - react-native-bluetooth-escpos-printer 编码土耳其语字符问题

react-native - showsMyLocationButton 在 android 中不起作用(react-native-maps)

iOS 位置权限请求仅显示英文,而其他按键正常工作

react-native 博览会问题 : check method of `SceneView`

javascript - 如何使用 react-native-scrollable-tab-view 从另一个组件切换标签

javascript - React Native 上无法识别的字体系列

performance - React-Native中动态样式的最高性能方式是什么?