You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "jamesfdickinson (via GitHub)" <gi...@apache.org> on 2023/05/24 23:23:29 UTC
[GitHub] [cordova-android] jamesfdickinson opened a new issue, #1616: Adaptive Icon not working with cordova-android 12
jamesfdickinson opened a new issue, #1616:
URL: https://github.com/apache/cordova-android/issues/1616
# Bug Report
Error:
"One of the following attributes are set but missing the other for the density type: mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi. Please ensure that all required attributes are defined."
## Problem
The adaptive icon is missing the background and the foreground is small with cordova-android 12. The adaptive icon works properly with cordova-android 11.
### What is expected to happen?
ic_launcher_background and ic_launcher_foreground assets are copied to the build.
### What does actually happen?
Only ic_launcher is created and copied and not ic_launcher_background and ic_launcher_foreground.
## Information
<!-- Include all relevant information that might help understand and reproduce the problem -->
Config.xml
```
<icon background="resources/android/icon/mipmap-mdpi/ic_launcher_background.png" density="mdpi" foreground="resources/android/icon/mipmap-mdpi/ic_launcher_foreground.png" />
<icon background="resources/android/icon/mipmap-hdpi/ic_launcher_background.png" density="hdpi" foreground="resources/android/icon/mipmap-hdpi/ic_launcher_foreground.png" />
<icon background="resources/android/icon/mipmap-xhdpi/ic_launcher_background.png" density="xhdpi" foreground="resources/android/icon/mipmap-xhdpi/ic_launcher_foreground.png" />
<icon background="resources/android/icon/mipmap-xxhdpi/ic_launcher_background.png" density="xxhdpi" foreground="resources/android/icon/mipmap-xxhdpi/ic_launcher_foreground.png" />
<icon background="resources/android/icon/mipmap-xxxhdpi/ic_launcher_background.png" density="xxxhdpi" foreground="resources/android/icon/mipmap-xxxhdpi/ic_launcher_foreground.png" />
```
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
Dev environment: Windows 10
Target platform: Android
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
cordova-android 12.0.0
cordova-cli 12
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] breautek commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1564390947
`background` refers to the background part of an adaptive icon. It must be paired with a `foreground` attribute. And due to this bug, on cordova-android@12 you'll also need the `monochrome` icon defined as well, but it isn't intended for you to require the `monochrome` icon to use adaptive icons. See https://cordova.apache.org/docs/en/11.x/config_ref/images.html#android for more information.
I'm hiding both of your post and this post because they are off-topic to the original issue. If you have any further questions please use the [discussions](https://github.com/apache/cordova/discussions) board
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] breautek commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1564396526
> Number 2 workaround including a monochrome icon resolved the adaptive icon bug.
>
> Thank you for the quick reply. I had reverted back to cordova-android 11, but with the workaround I was able to cleanly deploy with cordova-android 12. It was a little more work than I was planning. On the plus side, my app now supports themed icons (monochrome icons).
Glad it works for you, and as a side effect you're more compliant with the android app ecosystem.
But yah, the intended behaviour is to to require `foreground` and `background` if either is defined, but not require `monochrome`. However, `monochrome` does require an adaptive icon, so if `monochrome` is defined, it must also have `background` and `foreground` defined. Obviously that's not the actual case here, and that's not documented as a breaking change.
I don't know if I'll have time this weekend to look into it, but it is something I'm planning on tackling soon (perhaps the following weekend).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] tkem commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "tkem (via GitHub)" <gi...@apache.org>.
tkem commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1616827443
I'm also wondering, what would be the correct format for a "monochrome" PNG? Grayscale, indexed, or what?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] pr0pz commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "pr0pz (via GitHub)" <gi...@apache.org>.
pr0pz commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1620462876
I also managed to get it working but had to search deep to find out how to put an extra monochrome icon since it's not documented yet. This is my config.xml with vector based adaptive icons:
<icon foreground="xxx/ic_launcher_foreground.xml" background="xxx/ic_launcher_background.xml" monochrome="xxx/ic_launcher_monochrome.xml" density="XXX" src="xxx/XXX.png" />
The XML's are SVG's converted for android (Vector Drawable format, convert it here: https://svg2vector.com/ or in Android Studio )
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] KoreLewi commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "KoreLewi (via GitHub)" <gi...@apache.org>.
KoreLewi commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1564385494
I have the same problem.
I'm using Cordova 10.0.0 (cordova-lib@10.1.0) with Cordova platform android 11.0.0, and I'm getting the same error message for the following code:
```
<icon background="res/android/bcg.png" density="ldpi" src="res/android/ldpi.png" />
<icon background="res/android/bcg.png" density="mdpi" src="res/android/mdpi.png" />
<icon background="res/android/bcg.png" density="hdpi" src="res/android/hdpi.png" />
<icon background="res/android/bcg.png" density="xhdpi" src="res/android/xhdpi.png" />
<icon background="res/android/bcg.png" density="xxhdpi" src="res/android/xxhdpi.png" />
<icon background="res/android/bcg.png" density="xxxhdpi" src="res/android/xxxhdpi.png" />
```
"One of the following attributes are set but missing the other for the density type: mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi. Please ensure that all required attributes are defined."
I'm relatively new to Cordova, I want to deploy a quasar application with predefined icon background color.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] breautek closed issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek closed issue #1616: Adaptive Icon not working with cordova-android 12
URL: https://github.com/apache/cordova-android/issues/1616
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] breautek commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1562177571
Was able to reproduce the issue locally. I believe this is a regression from our https://github.com/apache/cordova-android/pull/1550 update. I didn't notice it was an issue before since I have a `src` fallback.
Until a patch is made, I think there are two workarounds:
1. Include a `src` attribute to your icons, which should be a full android drawable (either a rasterized PNG, and I believe android's AVD is also suppported). This will include icons for pre API 26 devices (and will also apply to API 26+ devices if the adaptive icons aren't present, which due to this bug they aren't). This of course has the caveat that your icons won't be adaptive icons and animations and such won't apply.
2. If you include a monochrome icon via the `monochrome` attribute which should lead to an android drawable that is a black and white version of your icon, then the adaptive icons do work as expected. API 33 devices with themes enabled will use this icon to produce a themeable icon that works in light mode, dark mode, and their choice of primary colour.
It isn't intended for monochrome icon to be **required** to use adaptive icons. So specifying just the `background` and `foreground` attributes is suppose to continue to work as it did before, so I've marked this as a bug and will add this issue to a 12.0.1 milestone.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] breautek commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1617026093
> I'm also wondering, what would be the correct format for a "monochrome" PNG? Grayscale, indexed, or what?
The monochrome should be the same as your foreground adaptive icon image, except it should only consist of two colours: an transparent background and pure black.
Android will colour in the black pixels according to the user's configured Android theme.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] jamesfdickinson commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "jamesfdickinson (via GitHub)" <gi...@apache.org>.
jamesfdickinson commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1562515357
Number 2 workaround including a monochrome icon resolved the adaptive icon bug.
Thank you for the quick reply. I had reverted back to cordova-android 11, but with the workaround I was able to cleanly deploy with cordova-android 12. It was a little more work than I was planning. On the plus side, my app now supports themed icons (monochrome icons).
<img src="https://github.com/apache/cordova-android/assets/6589952/f4d88d98-68e7-470e-a980-3f0d5938d1ef" height="400">
<img src="https://github.com/apache/cordova-android/assets/6589952/10c755aa-8586-425a-ac88-ab6d664ecee2" height="400">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] EYALIN commented on issue #1616: Adaptive Icon not working with cordova-android 12
Posted by "EYALIN (via GitHub)" <gi...@apache.org>.
EYALIN commented on issue #1616:
URL: https://github.com/apache/cordova-android/issues/1616#issuecomment-1605247566
@breautek is there any news regarding the icon?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org