[英]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.