Site cannot be installed: icon downloaded from the manifest was empty or corrupted

女生的网名这么多〃 提交于 2019-12-11 08:17:19

问题


I'm getting the error

Site cannot be installed: icon downloaded from the manifest was empty or corrupted

I'm not able to find what is the problem. Below is my manifest.json. I'm using Angular 4 Progressive web app with material design.

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"
}

回答1:


As stated in this document - Customize the icons, when placing the src path of the icon, it must refer to the root directory. You should change the path by removing / at the beginning and compile it again.

"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"
  }],

You can also check this related SO post for reference.



来源:https://stackoverflow.com/questions/46374037/site-cannot-be-installed-icon-downloaded-from-the-manifest-was-empty-or-corrupt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!