Search code examples
google-chrome-extensionchrome-extension-manifest-v2

Default Icons in manifest for Chrome Extension


I have this piece of code in my manifest:

"browser_action": {
  "default_icon": "icon.png",
  "default_popup": "popup.html",
  "default_icon": {
      "16": "images/16x16.png",
      "48": "images/48x48.png",
      "128": "images/128x128.png"
  }  
},

It was working fine until today and now I am getting a 'duplicate key' error. I know there are two entries for default_icon -- one for the old way of declaring a single icon, and the new way for declaring for specific sizes -- however it was not causing an issue when uploading the new packages until now. Did something change? If I remove the first declaration, what that cause any issues?

Update: I'm now getting an error where I can upload the zip file now, but publishing fails with 'Internal Publish Error'. When I first upload the zip, I did get a warning 'Invalid Manifest Content' but no other details. All of this was working until recently. Here is my manifest:

{
  "web_accessible_resources": [
  "files/*",
  "js/languages.json"
 ],

 "name": "Workspace Manager",
 "version": "0.962",
 "manifest_version": 2,
 "short_name": "Workspace Tab Manager extension.",
 "description": "Tab Manager and Productivity Extension - save tabs as workspaces and revisit them in the future",

  "icons": { 
    "16": "images/16x16.png",
    "48": "images/48x48.png",
    "128": "images/128x128.png" 
  },

 "background": {
   "scripts": ["background.js"],
   "persistent": false
 },

 "browser_action": {
   "default_icon": {
     "16": "images/16x16.png",
     "48": "images/48x48.png",
     "128": "images/128x128.png"
   },
   "default_popup": "popup.html"
 },

 "permissions": [
   "tabs",
   "storage"
 ],

 "content_security_policy": "script-src 'self' https://ajax.googleapis.com https://ssl.google-analytics.com https://www.googletagmanager.com; object-src 'self'"

 }

Solution

  • It turns out that duplicate keys are no longer allowed. And to fix it, you not only need to delete one of the duplicates (as I did), but you need to unpublish your extension entirely and then republish.

    It wasn't clear on what would happen when unpublishing. Essentially, you extension will disappear from the Webstore and when you republish, it takes longer than usual to review it. (it took about 2 days vs the normal couple hours). In that time it will say 'pending' but when it does get approved, everything in your store will be restored and it will be as though nothing happened.