akaita / easylauncher-gradle-plugin

Add a different ribbon to each of your Android app variants using this gradle plugin. Of course, configure it as you will
Apache License 2.0
959 stars 52 forks source link

Android 8.0.0 #22

Closed varo610 closed 6 years ago

varo610 commented 6 years ago

I really like the plugin but I can't make it work on Android 8.0.0 I have zero problems on previous versions. It compiles perfectly but the icon doesn't change.

Thank you

akaita commented 6 years ago

Can you share your configuration?

varo610 commented 6 years ago

easylauncher.gradle :

apply plugin: 'com.akaita.android.easylauncher'

easylauncher {

defaultFlavorNaming = true

productFlavors {
    dev {
        filters = customColorRibbonFilter("DEV", "#CD212A", "#FFFFFF")
    }

    devGer {
        filters = customColorRibbonFilter("devGER", "#009874", "#FFFFFF")
    }
}

}

app build.gradle:

apply from: '../easylauncher.gradle'

kylpo commented 6 years ago

Based on https://github.com/maskarade/gradle-android-ribbonizer-plugin/issues/23, it might be a problem with adaptive icons

shahsurajk commented 6 years ago

You can try this: Well as for a workaround, adaptive icons use a foreground and a background for the launcher icon, what could be done is:

  1. check for ic_launcher_foreground.xml in your res/drawable folder, this would be an svg icon for most users copy this and paste it in a separate variant-specific path, for ex. for debug builds paste it in debug/res/drawable/ic_launcher_foreground.xml, in the path element find the fillColor variable and change the color for some different value other than the one present there, this will be your identifier to that variant. Similar can be done for other variants as well.

  2. To modify the background, like the grayFilter you can find a file called ic_launcher_drawable.xml in your values folder, copy it and paste it in a variant-specific folder, for ex for debug it can be /debug/res/values/ic_launcher_background.xml and change the value ic_laucher_background.xml to something specific to your variant. run your app and try!

ps. thank you for this lib. saved me a lot of effort for non-oreo devices.

TamasBarta commented 6 years ago

I understand that in fact this lib fails to generate adaptive icons (I tried it, it doesn't work for our team either), but I fail to understand why. Adaptive icons are made of background and foreground images. (In our project one is a vector, other is a raster, so that shouldn't make a difference)

Why doesn't it work, if I specify the background or foreground drawable as one to be "ribbonized"? It should, shouldn't it?

TamasBarta commented 6 years ago

My bad, I just checked again, and the raster images are now removed. I checked again, and with raster images, the plugin works fine, so this is not an adaptive icon issue, but rather a vector image one.

For those who still have trouble, check if your image is in mipmap or drawable, that was the confusion for us, and provide it explicitly if needed in the configuration of the plugin. Ours is in drawable for some reason, but it shouldn't be an issue, since it's a vector image, so the plugin still doesn't work for our case. :(

akaita commented 6 years ago

I'm pretty late to the party 🙇 . @varo610 you need to provide the path to the foreground image of the adaptive icon. For example:

easylauncher {
    foregroundIconNames "@mipmap/ic_launcher_foreground" // Foreground of adaptive launcher icon
}

btw: @TamasBarta you are right, the plugin still doesn't support vector images. I have an open issue for that https://github.com/akaita/easylauncher-gradle-plugin/issues/9