简体   繁体   English

如何在WebStorm中的模拟器上运行React Native项目

[英]How to run React Native project on Emulator in WebStorm

I'm using WebStorm IDE for develop my React Native Android project. 我正在使用WebStorm IDE来开发我的React Native Android项目。 I have followed these steps in their website . 我在他们的网站上遵循了这些步骤。 But there is no way to connect with Emulator. 但是无法与Emulator连接。 When I run the project it show bellow error. 当我运行项目时,它显示波纹管错误。

在此处输入图片说明


Update 更新资料

在此处输入图片说明

在此处输入图片说明

There could be always something missing when you trying to use a library etc. My recommendation is npm uninstall realm and install again and check android directory if it is not realm linked decent, relink again manually or with following code react-native link realm. 当您尝试使用库等时,可能总会缺少某些东西。我的建议是npm install realm并再次安装,如果不是正确的链接,请检查android目录。请手动重新链接,或使用以下代码react-native link realm重新链接。

edit for updated post: try adb reverse tcp:8081 tcp:8081 . 编辑更新的帖子:尝试adb reverse tcp:8081 tcp:8081 If you have remotely debugging problem then try adb forward tcp:8082 tcp:8082 如果您有远程调试问题,请尝试使用adb forward tcp:8082 tcp:8082

It's better to create the react-native app with create-react-native-app and open created the folder in WebStorm rather than creating an app with WebStorm. 最好使用create-react-native-app并在WebStorm中打开创建的文件夹,而不是使用WebStorm创建应用程序。

It may be caused by incompatibility of react-native version that is using in WebStorm and your Android Studio version. 这可能是由于WebStorm中使用react-native版本与您的Android Studio版本不兼容引起的。 Also, I recommend using stable Node JS version. 另外,我建议使用稳定的Node JS版本。

create-react-native-app is the best way to create an app for today because it uses expo kit that provides you the wireless connection between your server and developing an app on your phone. create-react-native-app是今天创建create-react-native-app的最佳方法,因为它使用了expo工具包,该工具包可为您提供服务器与手机上的应用程序之间的无线连接。 It always uses the latest version of react and react-native that provides you stability versions and doesn't depend on WebStorm at all. 它始终使用最新版本的reactreact-native提供稳定版本,并且完全不依赖WebStorm。

Follow this steps to create a new app with expo kit. 请按照以下步骤操作,以使用Expo Kit创建新应用。

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

相关问题 不能再在模拟器上运行 React Native 项目了 - Cant run React Native Project on Emulator anymore 弹出npm run后如何在android模拟器上运行react native项目? - How to run react native project on android emulator after ejecting npm run? ADB 错误 - 无法在模拟器中运行 React Native 项目 - ADB error - unable to run React Native project in an emulator 如何使用模拟器在 Android Studio 中加载 React Native 项目? - How do I load React Native Project in Android Studio with an emulator? 如何为我的React Native项目合并一个Android模拟器? - How do I incorporate an Android emulator for my React Native project? 如何运行现有的 React Native 项目 - how to run an existing project of react native 无法运行本机应用程序 android 模拟器 - Unable to run react native app android emulator 反应在模拟器中本机运行android会抛出错误 - react native run android in emulator throws erro React Native Android App拒绝在模拟器上运行 - React Native android App refused to run on Emulator React Native WebStorm Emulator 无法启动 - 错误无法启动模拟器。 原因:找不到模拟器作为 `emulator -list-avds` 的 output - React Native WebStorm Emulator cannot start - error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM