-1

我无法在真实设备中从外部 url 加载任何图像。我总是收到以下错误:

在此处输入图像描述

这是我的capacitor.config.json

{
  ...,
  server: {
    cleartext: true,
    hostname: "rootsmenu.com",
    allowNavigation: [
      'localhost',
      'rootsmenu.com'
    ]
  }
}
4

1 回答 1

1

capacitor.config.ts使用以下配置进行了编辑,并且成功了!另外,我正在编辑错误的文件android/app/src/main/assets/capacitor.config.json。因为capacitor.config.ts每次跑的时候都换成内容npx cap sync android

{
  ...
  android: {
    allowMixedContent: true
  },
  server: {
    cleartext: true,
    hostname: "localhost"
  }
}
于 2022-01-10T19:39:30.517 回答