无法从Windows上的资产index.android.bundle加载脚本 [英] Unable to load script from assets index.android.bundle on windows

查看:81
本文介绍了无法从Windows上的资产index.android.bundle加载脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的设备(Android 4.2.2)上首次运行我的第一个React Native项目.

I'm trying to run my first React Native project for first time on my device (Android 4.2.2).

然后我得到:

无法从资产index.android.bundle加载脚本

unable to load script from assets index.android.bundle

我使用的命令:

  1. cd (project directory)
  2. react-native start
  3. react-native run-android
  1. cd (project directory)
  2. react-native start
  3. react-native run-android

推荐答案

我花了数小时试图弄清楚这个问题.我的问题并不特定于Windows,而是特定于Android.

I spent hours trying to figure this issue out. My problem was not specific to Windows but is specific to Android.

访问开发服务器可以在本地和仿真器的浏览器中进行.唯一不起作用的是访问应用程序中的开发服务器.

Accessing the development server worked locally and in the emulator's browser. The only thing that did not work was accessing the development server in the app.

从Android 9.0(API级别28)开始,默认情况下禁用明文支持.

Starting with Android 9.0 (API level 28), cleartext support is disabled by default.

AndroidManifest.xml

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>

有关更多信息,请参见: https://stackoverflow.com/a/50834600/1713216

See for more info: https://stackoverflow.com/a/50834600/1713216

这篇关于无法从Windows上的资产index.android.bundle加载脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆