Apache Cordova:“无法加载资源:服务器响应状态为404(找不到)”。

Apache Cordova:“无法加载资源:服务器响应状态为404(找不到)”。

问题描述:

我收到错误:无法加载资源:服务器使用javascript文件中的图标文件回应了状态404(找不到)。

I am getting error: "Failed to load resource: the server responded with a status of 404 (Not Found)" with icon file in javascript file.

var image = {
                url: "green.png",
                size: new google.maps.Size(20, 32),
                origin: new google.maps.Point(0, 0),
                anchor: new google.maps.Point(0, 32)
            };

var marker = new google.maps.Marker({
                position: { lat: latitude, lng: longitude },
                map: map,
                icon: image,
                title: ""
            });

我使用Visual Studio 2015与Apache Cordova。

I am using Visual Studio 2015 with Apache Cordova.

文件位于www / scripts / googlemap.js和www / scripts / green.png。

Files are located in www/scripts/googlemap.js and www/scripts/green.png.

编辑:
主要问题是来源。网址应为/scripts/green.png或scripts / green.png。我认为我之前尝试过,但不能让那些工作的原因。

Main problem was source. Url should be /scripts/green.png or scripts/green.png. I thought I tried these before but didn´t to get those working for some reason.

我没有使用任何插件。基本的JavaScript google地图与API。

I am not using any plugin. Basic javascript google maps with API.

我已经回答了我的第一篇文章,但问题是来源。网址应为/scripts/green.png或scripts / green.png。我以为我以前尝试过这些,但是没有得到那些工作的原因。

I already answered into my first post but the problem was source. Url should be /scripts/green.png or scripts/green.png. I thought I tried these before but didn´t to get those working for some reason.

有时在Visual Studio Rebuild不工作。首先要做清洁,而不是做。也许这是第一次的问题。不知道。但一切工作现在顺利!

Sometimes in Visual Studio Rebuild won´t work. Have to do first clean and than build. Maybe that was the problem for the first time. Dunno. But everything works now smoothly!