Closed npagare closed 5 years ago
The root of the problem is uppercase characters in resource names.
Even though your resources are named AdaptiveIcon_*
, they really get renamed adaptiveicon_*
while building your app, so your AdaptiveIcon.xml
and AdaptiveIcon_round.xml
need to be updated to use adaptiveicon_foreground
and adaptiveicon_background
:
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/adaptiveicon_background"/>
<foreground android:drawable="@mipmap/adaptiveicon_foreground"/>
</adaptive-icon>
Don't forget to change your [Activity...]
attribute in MainActivity
as well to point to: Icon = "@mipmap/adaptiveicon"
.
It might be least confusing to rename everything (including the resource files themselves) to lowercase.
@dellis1972 @jonathanpeppers not sure what the expectation here is, but should we be fixing up the manifest as well as xml resources to lowercase resources they reference?
Hi @Redth , thank you for looking into this and helping me out.
It seems that assets generated out of Image Asset Manager has to be named in the lowercase. But, the original assets could be named in a mixed case.
Attaching a copy of the Android Studio build log that provides precise error description around this issue. I would appreciate if Xamarin.Android build process either bubbles up that error description or have a similar meaningful explanation.
This problem is in our ConvertResourcesCases
task. It is not lowercasing the values in the adaptiveicon.xml
in the mipmap folders. So we end up with
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"><background android:drawable="@mipmap/AdaptiveIcon_background" /><foreground android:drawable="@mipmap/AdaptiveIcon_foreground" /></adaptive-icon>
which is incorrect. I'll add a unit test for this and then fix up the task to handle these files.
Steps to Reproduce
It will result the compilation failing indicating with the error - "error APT0000: No resource found that matches the given name (at 'drawable' with value '@mipmap/{iconname_background} | same for foreground layer.
Your help in addressing this error will be appreciated.
Repro solution - AdaptiveIconsAndroid.zip
Expected Behavior
Xamarin Forms - Android App to compile successfully and render adaptive icon depending on the target device and its resolution.
Actual Behavior
Build fails with the errors - 1>{User Directory}\source\repos\AdaptiveIconsAndroid\AdaptiveIconsAndroid\AdaptiveIconsAndroid.Android\Resources\mipmap-anydpi-v26\AdaptiveIcon.xml(2): error APT0000: No resource found that matches the given name (at 'drawable' with value '@mipmap/AdaptiveIcon_background'). 1>{User Directory}\source\repos\AdaptiveIconsAndroid\AdaptiveIconsAndroid\AdaptiveIconsAndroid.Android\Resources\mipmap-anydpi-v26\AdaptiveIcon.xml(2): error APT0000: No resource found that matches the given name (at 'drawable' with value '@mipmap/AdaptiveIcon_foreground'). 1>{User Directory}\source\repos\AdaptiveIconsAndroid\AdaptiveIconsAndroid\AdaptiveIconsAndroid.Android\Resources\mipmap-anydpi-v26\AdaptiveIcon_round.xml(2): error APT0000: No resource found that matches the given name (at 'drawable' with value '@mipmap/AdaptiveIcon_background'). 1>{User Directory}\source\repos\AdaptiveIconsAndroid\AdaptiveIconsAndroid\AdaptiveIconsAndroid.Android\Resources\mipmap-anydpi-v26\AdaptiveIcon_round.xml(2): error APT0000: No resource found that matches the given name (at 'drawable' with value '@mipmap/AdaptiveIcon_foreground').
Version Information
Log File
BuildOutput.log.txt