我怎么能得到index.android.bundle?

时间:2017-02-02 11:30:30

标签: android reactjs react-native

我使用了以下命令来运行但 index.android.bundle 没有得到。

react-native run-android 
react-native start

http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=true&minify=false

这不是给我包裹js做什么的。这是我在这个问题上存在的几天,我无法得到帮助。

以下是我的代码的截屏视频:

https://i.stack.imgur.com/tfmyM.png

提前致谢!

3 个答案:

答案 0 :(得分:8)

您的屏幕截图启动服务器以进行本机调试。

调试模式下的应用程序将指向此服务器js,然后您可以轻松更改代码以进行调试。

如果要打包捆绑包文件,可以使用以下命令:

机器人:

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

IOS:

react-native bundle --platform ios --dev false --assets-dest ./ios --entry-file index.ios.js --bundle-output ios/main.jsbundle

答案 1 :(得分:0)

我刚刚发现为什么我的本机应用程序没有构建捆绑js,因为守望者和卸载之前的守望者并安装新的守望者。工作正常谢谢。
使用以下代码。

$ git clone https://github.com/facebook/watchman.git
$ cd watchman/
$ git checkout v4.7.0
$ sudo apt-get install -y autoconf automake build-essential python-dev
$ ./autogen.sh 
$ ./configure 
$ make
$ sudo make install

$ watchman --version
$ echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches  && echo 999999 | sudo tee -a  /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee  -a /proc/sys/fs/inotify/max_user_instances && watchman  shutdown-server

答案 2 :(得分:0)

为我提供解决方案:

转到您的项目目录,并检查此文件夹是否存在 android / app / src / main / assets

i)如果存在,则删除两个文件即index.android.bundle和index.android.bundle.meta

ii)如果文件夹资产不存在,请在其中创建资产目录。

  1. 在您的根项目目录中执行

    cd android

    ./ gradlew clean

  2. 最后,导航回到根目录并检查

i)如果只有一个文件,即index.js,则运行以下命令

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

注意:那是一个命令。

ii)如果有两个文件,即index.android.js和index.ios.js,则运行以下命令:

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

这也是一个命令!

  1. 现在运行 react-native run-android

从此url, Click here to Check

找到了解决方案
相关问题