android - 模拟器屏幕卡在从 10.0.0.2:8081 加载时。可能是什么问题?
问题描述
我正在尝试在 android-emulator 中运行一个简单的入门应用程序,它显示的内容如下:
我不确定,我哪里出错了。以下是我到达这里的步骤:
- 反应原生初始化 HelloWorld
- 如上图所示设置 AVD
- react-native run-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 /主/资源
- react-native run-android
- 在另一个终端,我还使用启动了服务器
npm start
在运行命令 4 时,我收到一条错误消息watchman-crawl-failed
,可以通过参考这个 SO 帖子来解决
推荐阅读
- apache-spark - 通过 JDBC 驱动程序的 Databricks 表元数据
- sql - 如何在单个查询 (PSQL) 中更新一列中的不同值?
- date - Quicksight 计算字段中的最后 N 天
- python - 没有实例的模拟实例属性
- sharepoint - SharePoint 列表验证
- f# - 具有 BigInteger 索引的 F# 序列
- excel - 如何计算固定时间后的总工作时间?
- swift - 基于外部单例类中的属性的 SwiftUI 显示表
- flutter - 您如何知道用户何时滚动到列表颤动中的下一个小部件(之前的小部件不再可见)
- c# - ILASM.exe 显示关于 System.Memory 包的不同版本