简体   繁体   English

React-native 不会更新 android 中的更改

[英]React-native is not updating changes in android

When i try to run on android the latest code is not updating.当我尝试在 android 上运行时,最新的代码没有更新。 However, i can see the changes on IOS device.但是,我可以在IOS设备上看到更改。 I tried reseting the cache react-native start --reset-cache , i reinstalled watchman.But nothing helps me.我尝试重置缓存react-native start --reset-cache ,我重新安装了 watchman。但没有任何帮助。 Could anyone figure it out?有人能弄清楚吗?

finally i got the issue.I run the command react-native log-android and i got this error adb invocation failed最后我得到了这个问题。我运行命令react-native log-android并且我得到了这个错误adb invocation failed

so i link adb with exporting path.所以我将 adb 与导出路径联系起来。

  1. echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
  2. echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile

3. source ~/.bash_profile 3. source ~/.bash_profile

Now code are reflected on android device too.现在代码也反映在 android 设备上。

Make sure React Native Server is running.确保 React Native Server 正在运行。 If it is not running than do following如果它没有运行,请执行以下操作

steps :脚步 :

1) go to project path : cd '/home/himanshu/ReactNative_CLI/DemoApp' 1) 进入项目路径:cd '/home/himanshu/ReactNative_CLI/DemoApp'

2) Execute this command to start server: "react-native start" 2)执行此命令启动服务器:“react-native start”

3) if project not running : "react-native run-android" 3)如果项目没有运行:“react-native run-android”

4) Save file on your editor and you can see the changes on your device / emulator: 4) 在您的编辑器上保存文件,您可以在您的设备/模拟器上看到更改:

Note: make sure you have enabled reload on device / emulator :注意:确保您已在设备/模拟器上启用重新加载:

  • To enable reload on emulator: press "ctrl+M / Cmd + M / R,R(Press R Twise)"要在模拟器上启用重新加载:按“ctrl+M / Cmd + M / R,R(Press R Twise)”
  • To enable reload on real device : Shake your phone : it will show popup to reload.要在真实设备上启用重新加载:摇动您的手机:它会显示弹出窗口以重新加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM