Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How correctly set background color in android adaptive icon #7374

Closed
nikitok opened this issue Mar 16, 2020 · 15 comments · Fixed by expo/expo-cli#2087
Closed

How correctly set background color in android adaptive icon #7374

nikitok opened this issue Mar 16, 2020 · 15 comments · Fixed by expo/expo-cli#2087
Labels
Android needs more info To be used when awaiting reporter response

Comments

@nikitok
Copy link

nikitok commented Mar 16, 2020

Hi!
I want to set white color in my icon appication, but if i set these settings in app.json

    "android": {
      "package": "test.com",
      "adaptiveIcon": {
        "foregroundImage": "./assets/icon3.png",
        "backgroundColor": "#FFF"
      }
    }

I get dark green icon (((
My icon3.png for test
icon3

My screenshot from android emulator:
icon3.png
Screenshot 2020-03-16 at 7 21 38 PM

@cruzach
Copy link
Contributor

cruzach commented Mar 16, 2020

Hi! You'll need to rebuild your app for any changes to app.json to take place, otherwise your configuration looks right to me. Did you build the app previously with that value set to a shade of blue? Btw- the adaptiveIcon.backgroundColor should default to #ffffff, so if that's what you want you should just be able to leave it unspecified

@cruzach cruzach added Android needs more info To be used when awaiting reporter response labels Mar 16, 2020
@nikitok
Copy link
Author

nikitok commented Mar 17, 2020

I did these many times, and special create new app, and i have same result (

@cruzach
Copy link
Contributor

cruzach commented Mar 17, 2020

can you share your whole app.json?

@nikitok
Copy link
Author

nikitok commented Mar 18, 2020

{
  "expo": {
    "name": "Blank Template",
    "slug": "expoTest",
    "privacy": "public",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon3.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "scheme": "exp9697fa73838d456cb9764e29f57651e6",
    "android": {
      "package": "test.com",
      "adaptiveIcon": {
        "foregroundImage": "./assets/icon3.png",
        "backgroundColor": "#FFF"
      }
    }
  }
}

@IjzerenHein IjzerenHein changed the title How correctly set background color in android adaprive icon How correctly set background color in android adaptive icon Mar 18, 2020
@cruzach
Copy link
Contributor

cruzach commented Mar 18, 2020

and what SDK version is this? Sorry, that's usually included in the app.json file or else I would've asked for that before

@zlep
Copy link

zlep commented Mar 31, 2020

I have the same problem. SDK36.

"android": { "package": "com.test_app", "versionCode": 1, "adaptiveIcon": { "foregroundImage": "./assets/icon.png", "backgroundColor": "#ff0012" },

I also have a weird blue background instead of my ff0012

@LucaRed
Copy link

LucaRed commented Apr 17, 2020

I also have this problem, but I'd word it differently.

The problem is that the icon shown in the recent apps switcher completely ignores the Adaptive Icon set in android.adaptiveIcon and shows the wrong generic icon instead.

It was already reported on the Expo forums in July 2019.

@cruzach
Copy link
Contributor

cruzach commented May 1, 2020

thanks for the info @LucaRed ill take a look

@cruzach
Copy link
Contributor

cruzach commented May 4, 2020

Note that a good workaround for now is to use the backgroundImage property, and just make it a blank image of the background color you prefer

@gbkwiatt
Copy link

gbkwiatt commented May 23, 2020

backgroundImage does nothing unfortunately.

"icon": "./assets/icon.png",
 "android": {
"adaptiveIcon": {
        "foregroundImage": "./assets/icon.png",
        "backgroundImage": "./assets/bg-white.png"
      },
}

@gbkwiatt
Copy link

solution is to use in your app.json "primaryColor": "#FFFFFF",

@MathMesquita
Copy link

Happening here in SDK 37, setting primaryColor didn't take any effect. :(

@JJwilkin
Copy link

JJwilkin commented Sep 2, 2020

Hi, @byCedric had recommended this thread to me, I notice I'm having much of the same issues. @nikitok I notice you expo.icon and android.adaptiveIcon.foregroundImage have the same icon. I believe that's what led you to believe only the background color/image wasn't working however from my experience Expo only pays attention to the expo.icon. If you changed your android.adaptiveIcon.foregroundImage to be different than expo.icon are those changes reflected? They are currently not for me, Expo SDK 38

{
  "name": "ChowTime",
  "displayName": "ChowTime",
  "expo": {
    "name": "ChowTime",
    "slug": "ChowTime",
    "version": "3.0.0",
    "icon":"./assets/icon.png",
    "android": {
      "package": "com.yourcompany.chowtime",
      "versionCode": 2,
      "icon": "./assets/green.png",
      "adaptiveIcon": { 
        "foregroundImage": "./assets/green.png",
        "backgroudnImage": "./assets/green-background.png" 
      }
    },
    "splash": {
      "image": "./assets/splashScreen.png",
      "resizeMode": "cover"
    },
    "platforms": ["ios", "android", "web"],
    "assetBundlePatterns": ["**/*"]
  }
}

@JosiasBatista
Copy link

I'm having the same issue with similar especifications in my app.json! I don't know what's happening. I followed the expo guide for build the adaptive icon, but it doesn't work properly!

@brentvatne
Copy link
Member

@JosiasBatista: https://docs.expo.dev/versions/latest/config/app/#adaptiveicon

if the background color isn't working as expected for you then create a new issue and fill out the issue template

@expo expo locked as off-topic and limited conversation to collaborators Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android needs more info To be used when awaiting reporter response
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants