Open NinjaRat84 opened 6 years ago
+1
+1
+1
Can you please provide a bit more info to this issue. What file format is it? It should support SVG, maybe to fix is a simple one.
@HazAT They're Android vector drawable resources - the files are XML files.
Here's the Android documentation that explains about Adaptive Icons on Android 8: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
Here's an example of a vector resource:
<!-- res/drawable/battery_charging.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
<!-- intrinsic size of the drawable -->
android:height="24dp"
android:width="24dp"
<!-- size of the virtual canvas -->
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<group
android:name="rotationGroup"
android:pivotX="10.0"
android:pivotY="10.0"
android:rotation="15.0" >
<path
android:name="vect"
android:fillColor="#FF000000"
android:pathData="M15.67,4H14V2h-4v2H8.33C7.6,4 7,4.6 7,5.33V9h4.93L13,7v2h4V5.33C17,4.6 16.4,4 15.67,4z"
android:fillAlpha=".3"/>
<path
android:name="draw"
android:fillColor="#FF000000"
android:pathData="M13,12.5h2L11,20v-5.5H9L11.93,9H7v11.67C7,21.4 7.6,22 8.33,22h7.33c0.74,0 1.34,-0.6 1.34,-1.33V9h-4v3.5z"/>
</group>
</vector>
Which was taken from this page: https://developer.android.com/guide/topics/graphics/vector-drawable-resources
Android doesn't support displaying SVG files out of the box, so when we want to use vector assets we import an SVG and it gets converted into the format above
I have the same issue.
I'm trying to support Adaptive icons on Android. In adaptive icons, there are different launcher icons are generated. so, I am trying to add badge and shield to all of them like below code snippet :
badge(glob: "/app/src/main/res/mipmap-*/ic_launcher.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true
)
badge(glob: "/app/src/main/res/mipmap-*/ic_launcher_foreground.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true
)
badge(glob: "/app/src/main/res/mipmap-*/ic_launcher_round.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true
)
Badge is looking okay but shield ( I am using shield for build number ) does not seem on adaptive icons. I need to add something like shield_geometry "+0+25%" but it does not work.
as per documentation : https://github.com/HazAT/badge#--6
When I use shield_geometry on fastlane like this :
badge(glob: "/app/src/main/res/mipmap-*/ic_launcher_round.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true,
shield_geometry: "+0+25%"
)
it procudes this error :
fastlane finished with errors
[!] Could not find option 'shield_geometry' in the list of available options: dark, custom, no_badge, shield, alpha, path, shield_io_timeout, glob, alpha_channel, shield_gravity, shield_no_resize
+1
It doesn't work for me even if I badge for ic_launcher.png
, ic_launcher_foreground.png
and ic_launcher_round.png
. On older version of android it works like a charm.
Here is my configuration. Hoping it would help anyone out:
badge(
shield: "BETA-0.0.1-orange",
no_badge: true,
dark: true,
shield_scale: "0.55",
shield_gravity: "Center",
shield_geometry: "+0+30%",
glob: "/app/src/main/res/mipmap-*/ic_launcher*.png",
)
I'd love to see this fixed. Does anyone have ideas on what needs to be done?
I suspect the problem with later Android versions is that the plugin doesn't support badging of adaptive icons.
Either that would need to be done or, as a workaround, you could remove the adaptive icon files in your badged builds and later versions of Android would then fall back to using the legacy launcher icon instead (which is badged)
This is what I finally did after reading conflicting reports of badging partially working on adaptive icons. I suspect all of those reports were from people testing pre-8 devices or did not have adaptive icons setup properly. I ended, copying the mipmaps to the res/
@hyei thanks, I'll take a look at that
@osamaq wonderful!. The glob: "/app/src/main/res/mipmap-*/ic_launcher*.png",
works with fastlane even when real directory would be "../app/src/main/res/mipmap-*/ic_launcher*.png"
I can see the icons updating with shield values config and version at locations src/main/res & src/debug/res, After build and installed the app, I can see the shield values on app icon for android 7 and doesn't see them in Android (>= 8). May I know is there any update on this.
plugin version used: fastlane-plugin-badge 1.4.0 lane :android_shield do |options| add_badge( shield: "#{ENV['CONFIG']}-#{ENV['VERSION']}-green", no_badge: true, glob: "/app/src/*/mipmap-/launcher_icon.png", shield_scale: "0.90" ) end
@harasai see my comment above, the plugin doesn't badge adaptive icons (probably in your project as ic_launcher*.xml)
As workaround for adaptive icons i'm using only glob: "/app/src/main/ic_launcher-playstore.png"
for creating badge. And then using it to create icons with New -> Image Asset
option from Android Studio which generates all icons correctly
I could not get the default badge reasonably positioned for both IOS and Android adaptive and Android legacy icons. So i created a new set of badges. For anyone who is interested
https://github.com/bobsmits/gem-badge-adaptive-icon-set/tree/main
Here is my configuration. Hoping it would help anyone out:
badge( shield: "BETA-0.0.1-orange", no_badge: true, dark: true, shield_scale: "0.55", shield_gravity: "Center", shield_geometry: "+0+30%", glob: "/app/src/main/res/mipmap-*/ic_launcher*.png", )
Using this glob configuration, all mipmap launchers in the .png format were badged correctly.
I then *moved all adaptive launcher icons (.xml) to the prod source set**, which resulted in Android falling back onto the badged icons for non-prod builds.
Unfortunately, that way, Samsung (and probably other) phones will squeeze the icon into their adaptive form. The badge is still readable, but it is not beautiful. However, it may still be useful to some of you as a workaround.
Hi,
Badge does not seems to be added on versions 8 and 9 for Android which uses vector icons as ic_launcher_foreground and ic_launcher_background.
Should this be a future enhancement?
Best regards, H