react-native run-android 部署旧版本 [英] react-native run-android deploys old build

查看:50
本文介绍了react-native run-android 部署旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm building a react-native android app. I am using Windows as my development area. To push my app to my phone, I simply connect the phone via USB to my computer and then I run the command react-native run-android.

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

This works fine and exactly as expected on one of my android phones.

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

I have a second older android phone, but every time I run react-native run-android, it receives an old and out-dated version of the app from 2-3 days ago, when I last connected the phone to my computer. I tried to manually uninstall the app from my phone, I tried restarting my phone, I tried taking out the battery, but every time I deploy, it still receives the old version.

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

How do I get my second android phone to receive the latest version?

推荐答案

如果你看看他们的 文档Reload JS 仅适用于带 USB 调试的 Android 5 及更高版本.您可能想为旧设备尝试方法 2:

If you look at their documentation, Reload JS only works on Android 5 and above with USB debugging. You may want to try method 2 for older devices:

方法 2:通过 Wi-Fi 连接

Method 2: Connect via Wi-Fi

您还可以通过 Wi-Fi 连接到开发服务器.您首先需要使用 USB 电缆在您的设备上安装该应用程序,但是一旦安装完成,您就可以按照这些说明进行无线调试.在继续之前,您需要您的开发机器的当前 IP 地址.

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.

打开终端并输入/sbin/ifconfig 以查找您机器的 IP 地址.

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

确保您的笔记本电脑和手机在同一个 Wi-Fi 网络中.在您的设备上打开您的 React Native 应用程序.您会看到一个带有错误的红色屏幕.还行吧.以下步骤将解决该问题.打开应用内开发者菜单.转到设备的开发设置 → 调试服务器主机.输入您机器的 IP 地址和本地开发服务器的端口(例如 10.0.1.1:8081).返回开发人员"菜单并选择重新加载 JS".

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.

您现在可以从开发人员菜单启用实时重新加载.只要您的 JavaScript 代码发生更改,您的应用就会重新加载.

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

这篇关于react-native run-android 部署旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆