When trying to add an adaptive icon in config.xml I get the following error when trying to build
One of the following attributes are set but missing the other for the density type: ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi. Please ensure that all require attributes are defined.
My code is:
<platform name="android">
<resource-file src="res/icon/android/colors.xml" target="/app/src/main/res/values/colors.xml" />
<icon background="@color/background" density="ldpi" foreground="res/icon/android/ldpi-foreground.png" />
<icon background="@color/background" density="mdpi" foreground="res/icon/android/mdpi-foreground.png" />
<icon background="@color/background" density="hdpi" foreground="res/icon/android/hdpi-foreground.png" />
<icon background="@color/background" density="xhdpi" foreground="res/icon/android/xhdpi-foreground.png" />
<icon background="@color/background" density="xxhdpi" foreground="res/icon/android/xxhdpi-foreground.png" />
<icon background="@color/background" density="xxxhdpi" foreground="res/icon/android/xxxhdpi-foreground.png" />
</platform>
I'm using cordova-android 8.0.0
Pasting for reference here the answer to the same question (asked by the same dev) provided here.
@Fmaldonado6 After some digging through the code I found that it was because I was using global cordova [email protected], upgrading to [email protected] via npm i -g [email protected] fixed the problem for me. This is because even though we upgraded to [email protected] in our project this library depends on information passed to it from the globally installed cordova library which it gets from [email protected] whereas [email protected] has [email protected] which does not pass along foreground and background props
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With