Android 图像未加载到使用cordova构建的移动应用程序中

Android 图像未加载到使用cordova构建的移动应用程序中,android,angular,cordova,Android,Angular,Cordova,我有一个运行良好的angular应用程序,从中我用ApacheCordova构建了一个移动应用程序。移动应用程序工作正常,只是因为找不到路径而没有加载图像 以下是我的文件结构: angular.json package.json config.xml src assets index.html www assets index.html 以下是angular.json的一部分: &q

我有一个运行良好的angular应用程序,从中我用ApacheCordova构建了一个移动应用程序。移动应用程序工作正常,只是因为找不到路径而没有加载图像

以下是我的文件结构:

    angular.json
    package.json
    config.xml
    src
        assets
        index.html
    www
        assets
        index.html
以下是angular.json的一部分:

    "outputPath": "www",
    "baseHref": "",
    "deployUrl": "",
    "index": "src/index.html",
    "main": "src/main.ts",
    "polyfills": "src/polyfills.ts",
    "tsConfig": "tsconfig.app.json",
    "aot": true,
    "assets": [
      "src/assets"
    ],
    "styles": [
      "src/assets/css/AdminLTE.css"
    ],
    "scripts": [
      "src/assets/adminlte.min.js"
      "src/assets/bootstrap.min.js"
    ]
我还将
标记从“/”更改为“/”。在index.html中

以下是我使用的命令:

    ng build --aot --prod
    cordova run android --device
    or
    cordova serve 1234
在我的移动设备上运行时,以及使用cordova serve在浏览器上测试时,都会出现问题

以下是我的开发控制台的输出:

GEThttp://localhost:1234/android/www/index.html/scada/assets/spot.png 404(未找到)

“scada”是app.routing.ts中定义的当前URL路径。这意味着此时的实际URL为:

http://localhost:1234/scada
奇怪的是,其他一切都在起作用。甚至脚本也可以完美地加载

有人能告诉我发生了什么事吗


提前谢谢

好的,对于任何感兴趣的人来说,经过大量的调试和挖掘,下面是答案:

与大多数人的状态相反,应该在
中定义的路径

然后,

请注意,在路径前面添加
/
对chrome有效,但对设备无效


顺便说一句,
chrome://inspect
是一个很好的工具,可用于清除设备上运行的cordova应用程序的bug。

尝试在图像中定义src,如
[src]=“/assets/spot.png”
-请参阅
/
初始值。使用
cordova serve端口在浏览器上运行时,该选项有效。然而,当我在带有
cordova run android--device
的设备上运行时,它不起作用。未加载图像。有什么想法吗?