简体   繁体   English

React Native package 服务器未连接到 Android 模拟器

[英]React Native package server not connected to Android simulator

I'm running my react native app on an android simulator.我在 android 模拟器上运行我的 react 本机应用程序。 My app works fine and is connected with my react-native package server (npm start command I used to start my server) with the android simulator Galaxy J3 series and Galaxy pixel C series. My app works fine and is connected with my react-native package server (npm start command I used to start my server) with the android simulator Galaxy J3 series and Galaxy pixel C series. But the same app won't work (packages not loading through server) with the latest Android simulator Samsung Galaxy S21 Ultra API 28. It throws an error, Could not connect to the development server Note: I set the dev setting the same to all simulators is same.但是相同的应用程序将无法使用最新的 Android 模拟器三星 Galaxy S21 Ultra API 28 运行(未通过服务器加载包)。它会引发错误,无法连接到开发服务器注意:我将开发设置设置为所有模拟器是一样的。 Android studio version: 3.6.1 Android工作室版:3.6.1 在此处输入图像描述

Build.grdle构建.grdle

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 21
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

After searching and a lot of trials I end up with the solution.经过搜索和大量试验,我最终得到了解决方案。 I added android:usesCleartextTraffic="true" line in <application tag in androidmanifest.xml file.我在androidmanifest.xml文件的<application标签中添加了android:usesCleartextTraffic="true"行。 Then I rerun the app.然后我重新运行该应用程序。

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

相关问题 React Native-Android Simulator的文本转换问题 - React Native - Text Transform issue with Android Simulator React Native在Android模拟器中打开到白屏 - React Native opens to white screen in Android simulator React - 本机 IOS/Android 模拟器问题 - React - Native IOS/Android Simulator problem Android 模拟器未加载 react-native 应用程序 - Android simulator is not loading react-native application React Native应用程序可在模拟器上运行,但不能在Android设备上运行 - React Native app working on simulator but not on a android device 如何为React Native打包一个android native模块 - How to package an android native module for React Native React native 无法使用 android 模拟器连接到 react-devtools - React native Cannot connect to react-devtools using android simulator React Native应用程序:无法连接到开发服务器,但是模拟器正在运行-为什么? - React Native app: cannot connect to dev server, but the simulator is running - why? React Native:仅当调试打开且仅在Android上时,App才会在模拟器中崩溃 - React Native: App crashes in simulator only when debugging is on and only on Android 使本机反应使用位于其他计算机上的 Android 模拟器 - making react native to use a Android simulator located at other computer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM