我收到了错误
无法安装网站:从清单下载的图标为空 或者已损坏
我无法找到问题所在。以下是我的manifest.json
。我正在使用带有材料设计的Angular 4 Progressive Web应用程序。
的manifest.json
{
"dir": "ltr",
"lang": "en",
"name": "Hello",
"scope": "/",
"display": "standalone",
"start_url": "./?utm_source=web_app_manifest",
"short_name": "Hello",
"theme_color": "#f27b00",
"description": "",
"orientation": "any",
"background_color": "#3a1c8d",
"related_applications": [],
"prefer_related_applications": false,
"icons": [{
"src": "/assets/icons/android/android-launchericon-512-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/assets/icons/android/android-launchericon-192-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/icons/android/android-launchericon-144-144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/assets/icons/android/android-launchericon-96-96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "/assets/icons/android/android-launchericon-72-72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "/assets/icons/android/android-launchericon-48-48.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "/assets/icons/chrome/chrome-extensionmanagementpage-48-48.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "/assets/icons/chrome/chrome-favicon-16-16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "/assets/icons/chrome/chrome-installprocess-128-128.png",
"sizes": "128x128",
"type": "image/png"
}
],
"gcm_sender_id": "XXXXXXXX"
}
答案 0 :(得分:1)
如本文档中所述 - Customize the icons,当放置图标的src
路径时,它必须引用根目录。您应该通过在开头删除/
并再次编译来更改路径。
"icons": [{
"src": "images/touch/icon-128x128.png",
"type": "image/png",
"sizes": "128x128"
}, {
"src": "images/touch/apple-touch-icon.png",
"type": "image/png",
"sizes": "152x152"
}, {
"src": "images/touch/ms-touch-icon-144x144-precomposed.png",
"type": "image/png",
"sizes": "144x144"
}, {
"src": "images/touch/chrome-touch-icon-192x192.png",
"type": "image/png",
"sizes": "192x192"
}],
您也可以查看此related SO post以供参考。