react-native run-android 在设备上构建旧版本的代码 [英] react-native run-android builds an old version of the code onto device

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

问题描述

这发生在生产和开发版本中.我可以连接到开发服务器,重新加载,并且新代码在设备上构建并运行.

This occurs in both production and dev builds. I can connect to the dev server, reload, and the new code is built and runs on the device.

我尝试过的分步说明:

  1. 修改代码.

  1. Modify code.

重新捆绑:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-目标 android/app/src/main/res

  1. ./gradlew clean

react-native run-android - 构建旧版本

react-native run-android --variant=release - 构建旧版本

有什么办法可以彻底清除 android 构建并从头开始构建?我的直觉告诉我 run-android 没有执行完全干净的构建.

Is there any way to completely wipe the android build and build from scratch? My gut tells me that run-android is not performing a full clean build.

推荐答案

  1. 删除目录 android/app/src/main/assets 中的文件.
  2. run $ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --资产目标 android/app/src/main/res
  3. $ react-native run-android

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

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