模拟器屏幕卡在从 10.0.0.2:8081 加载。可能是什么问题?
Emulator screen stuck at loading from 10.0.0.2:8081. What could be the issue?
我正在尝试 运行 在 android 模拟器中创建一个简单的入门应用程序,它显示的内容如下:
我不确定,我哪里错了。以下是我到达此处所遵循的步骤:
- react-native init HelloWorld
- 如上图所示设置 AVD
- react-native 运行-android
就是这样。这是命令 react-native run-android
:
的输出
Scanning folders for symlinks in /home/suhail/test/react-native/HelloWorld/node_modules (10ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_Phone(AVD) - 6.0' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 1m 48s
28 actionable tasks: 1 executed, 27 up-to-date
Running /home/suhail/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (/home/suhail/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.helloworld/com.helloworld.MainActivity)...
Starting: Intent { cmp=com.helloworld/.MainActivity }
没有显示任何错误信息。那有什么我想念的吗?
我终于能够使用@Nguyen 的回答和其他一些步骤解决问题。以下是我遵循的步骤:
- 在模拟器上按 ctrl+m (Linux) 并打开开发者菜单。
- 选择调试服务器和端口并将值设置为localhost:8081
- mkdir android/app/src/main/assets
- 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
- react-native 运行-android
- 在另一个终端我也使用
npm start
启动了服务器
当运行执行命令4时,我得到一个错误说watchman-crawl-failed
,可以参考
解决
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
pkill node
我正在尝试 运行 在 android 模拟器中创建一个简单的入门应用程序,它显示的内容如下:
我不确定,我哪里错了。以下是我到达此处所遵循的步骤:
- react-native init HelloWorld
- 如上图所示设置 AVD
- react-native 运行-android
就是这样。这是命令 react-native run-android
:
Scanning folders for symlinks in /home/suhail/test/react-native/HelloWorld/node_modules (10ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_Phone(AVD) - 6.0' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 1m 48s
28 actionable tasks: 1 executed, 27 up-to-date
Running /home/suhail/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (/home/suhail/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.helloworld/com.helloworld.MainActivity)...
Starting: Intent { cmp=com.helloworld/.MainActivity }
没有显示任何错误信息。那有什么我想念的吗?
我终于能够使用@Nguyen 的回答和其他一些步骤解决问题。以下是我遵循的步骤:
- 在模拟器上按 ctrl+m (Linux) 并打开开发者菜单。
- 选择调试服务器和端口并将值设置为localhost:8081
- mkdir android/app/src/main/assets
- 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
- react-native 运行-android
- 在另一个终端我也使用
npm start
启动了服务器
当运行执行命令4时,我得到一个错误说watchman-crawl-failed
,可以参考
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
pkill node