Set the app's icon on Android

Hello. I am having difficulty with setting the app’s icon on Android.

I read both this thread https://www.fusetools.com/community/forums/general/app_almost_done

and this page https://www.fusetools.com/learn/guides/uno-project-format

(These were the only documentation I could find that referred to the app icon)

When I build and run on my phone, the app icon is the white Fuse parallelogram on a dark gray background.

Here is what my unoproj file looks like

{
  "BuildDirectory": "build",
  "InternalsVisibleTo": [],
  "Packages": [
    "Fuse.Animations",
    "Fuse.BasicTheme",
    "Fuse.Controls",
    "Fuse.Designer",
    "Fuse.Drawing",
    "Fuse.Drawing.Primitives",
    "Fuse.Scripting",
    "Fuse.Reactive",
    "Fuse.Effects",
    "Fuse.Elements",
    "Fuse.Entities",
    "Fuse.Gestures",
    "Fuse.Navigation",
    "Fuse.Desktop",
    "Fuse.Android",
    "Fuse.iOS",
    "Fuse.Shapes",
    "Fuse.Triggers",
    "FuseCore",
    "Uno.Collections",
    "Uno.Geometry",
    "Fuse.PushNotifications",
  ],
  "Projects": [],
  "Icon": "Assets/myicon.png",
  "Android" : {
      "GooglePlay": {
          "SenderID": "8675309"
      },
      "Key" : {
          "Alias" : "KEY ALIAS",
          "AliasPassword" : "hunter2",
          "Store" : "AIR SHIELD",
          "StorePassword" : "12345"
      },
      "Icons": {
        "LDPI": "$(Icon)",
        "MDPI": "$(Icon)",
        "HDPI": "$(Icon)",
        "XHDPI": "$(Icon)",
        "XXHDPI": "$(Icon)",
        "XXXHDPI": "$(Icon)"
      }
  },  "Includes": ["*"]
}

Thank you.

Hi!

What command are you using to build your project?

uno build --target=android --configuration=Release --run

bump

Hi Matt,

Can you please elaborate a bit on what problem you are having? Have you tried setting "Icon" in you unoproj, and it still doesn’t use that icon?

Which version of Fuse are you using, which command do you use to build your app, and what kind of device are you seeing this problem on?

Same thing, my unoproj looks like this:

"Icons": {
  "MDPI": "Assets/Icons/Android/mipmap-mdpi/ic_launcher.png",
  "HDPI": "Assets/Icons/Android/mipmap-hdpi/ic_launcher.png",
  "XHDPI": "Assets/Icons/Android/mipmap-xhdpi/ic_launcher.png",
  "XXHDPI": "Assets/Icons/Android/mipmap-xxhdpi/ic_launcher.png",
  "XXXHDPI": "Assets/Icons/Android/mipmap-xxxhdpi/ic_launcher.png"
 }

but all I get is the stock icon from Fuse. Also it looks like all docs about icons is gone from the web…?

Hi, I just tried it here, and it works as expected. Did you remember to put "Icons" inside "Android"? Here’s my full .unoproj that gets me the right icons:

{
  "RootNamespace":"",
  "Packages": [
      "Fuse",
      "FuseJS"
  ],
  "Includes": [
    "*"
  ],
  "Android": {
      "Icons": {
          "LDPI": "Assets/ldpi.png",
          "MDPI": "Assets/mdpi.png",
          "HDPI": "Assets/hdpi.png",
          "XHDPI": "Assets/xhdpi.png",
          "XXHDPI": "Assets/xxhdpi.png",
          "XXXHDPI": "Assets/xxxhdpi.png",
      }
 }
}

Note also that we only use your own icons for export, for preview you always get the Fuse preview icon.

The documentation for the .unoproj format has moved to https://www.fusetools.com/docs/basics/uno-projects, in particular the Android icon section is at https://www.fusetools.com/docs/basics/uno-projects#Android.Icons. (I just noticed we have some problems with the links there, I’ll make sure those are fixed.)

Here is my full unoproj and it’s only getting me the stock ones :confused:

Maybe it’s something wrong with how I build? I usually run fuse build --target=Android --configuration=Release once, then edit the AndroidManifest.xml with the correct codeVersion, then run ./build/Android/Release/build.sh at which point the apk is good enough for the store. However, a manual install on my phone gives me the stock icons…

{
  "RootNamespace":"",
  "Title":" Notes",
  "Mobile": {
    "Orientations": "Portrait"
  },
  "Packages": [
        "Fuse",
        "FuseJS"
  ],
  "Includes": [
    "*"
  ], "Android": {
    "Icons": {
      "LDPI": "Assets/Icons/Android/mipmap-ldpi/icon.png",
      "MDPI": "Assets/Icons/Android/mipmap-mdpi/icon.png",
      "HDPI": "Assets/Icons/Android/mipmap-hdpi/icon.png",
      "XHDPI": "Assets/Icons/Android/mipmap-xhdpi/icon.png",
      "XXHDPI": "Assets/Icons/Android/mipmap-xxhdpi/icon.png",
      "XXXHDPI": "Assets/Icons/Android/mipmap-xxxhdpi/icon.png"
     },
    "Key": {
      "Alias": "###",
      "AliasPassword": "###",
      "Store": "###",
      "StorePassword": "###"
    }
  }
}

Hi Cyril, I shouldnt be a problem to use build.sh directly, but I’ll admit I havent tried that yet. A couple of questions:

If your answers for the above are both ‘yes’ then could we get a copy of your project so see if we could debug the issue on this end? If so please push a zip to https://www.dropbox.com/request/ZgndLtJQm5eGzG9cicGK

Thanks for your help working through this with us, I hope we can beat this thing so it doesnt bite you or anyone else again

Hi Chris,

regarding the sizes: they were all correct, standard sizes.

regarding the debug build: how do I get it?

Sorry for the slow reply, I’ve been out of the country visiting family.

Unless you are building in release mode it should be in debug. Regarding my earlier request, would it be possible to get a copy of your project so see if we could debug the issue on this end? This is a fiddly one to reproduce without your exact files so if you could send a zip to https://www.dropbox.com/request/ZgndLtJQm5eGzG9cicGK it would really speed this up.

Hi Chris,

I had branched my git project with the failing icons, so that I could keep making progress on my app while still being able to provide you with the faulty code.

However, I tried to build again from this branch and the .apk I got… had the good icons. So even I couldn’t reproduce the issue, even with the exact files.

Note sure what I can do at this point, do you still need the files (I’d rather not share them too much as they include the release.keystore)?

Hmm this is sounding like you have been a victim of a bug we have than can cause android projects not to rebuild properly after changes to just the unoproj.

I recommend running uno clean in the project directory after you switch branch and then see if you still have the issue.

Sorry this one has got you, we do have a ticket open for it and we will get on it as soon as we can.

I did run uno clean between the build :confused:

What a pain! Sorry to ask again but do you now have any branches with the issue?

I don’t at the moment, but I’ll keep an eye out for the bug!

This worked for me … I moved the app icon to the root of my project and renamed it to icon.png.

...
"Icon" : "icon.png",
"Android": {
"Icons": {
            "LDPI": "$(Icon)",
            "MDPI": "$(Icon)",
            "HDPI": "$(Icon)",
            "XHDPI": "$(Icon)",
            "XXHDPI": "$(Icon)",
            "XXXHDPI": "$(Icon)"
        }
}