0

I have been tasked with updating all of the 3rd party dependencies in a Xamarin.Forms app. These had been left at various versions dating back as far as a year. I am somewhat new to Xamarin.Forms and much more familiar with iOS development than with Android development.

This update included a change from Xamarin.Forms 2.5 to 3.1 among other things. The iOS build is working fine, but in the Android project I am seeing 12 missing resource errors, all seemingly related to Notifications (I've snipped off the beginnings of the file paths):

.../obj/Debug/lp/34/jl/res/values/values.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Info'.
.../obj/Debug/lp/34/jl/res/values-v21/values-v21.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Info'.
.../obj/Debug/lp/34/jl/res/values-v24/values-v24.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Info'.
.../obj/Debug/lp/34/jl/res/values/values.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification'.
.../obj/Debug/lp/34/jl/res/values-v21/values-v21.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification'.
.../Debug/lp/34/jl/res/values-v24/values-v24.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification'.
.../Debug/lp/34/jl/res/values/values.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Time'.
.../obj/Debug/lp/34/jl/res/values-v21/values-v21.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Time'.
.../obj/Debug/lp/34/jl/res/values-v24/values-v24.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Time'.
.../obj/Debug/lp/34/jl/res/values/values.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Title'.
.../obj/Debug/lp/34/jl/res/values-v21/values-v21.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Title'.
.../obj/Debug/lp/34/jl/res/values-v24/values-v24.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.Compat.Notification.Title'.

From my research so far it sounds like this kind of error can be caused by inadvertently targeting multiple versions of the Android SDK or using the wrong tools version (See: Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23). I have updated all of the Xamarin.Android.Support.* libraries to their latest versions:

<Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable">
  <HintPath>..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Annotations">
  <HintPath>..\packages\BiInc.Mobile.Framework.4.5.1.0\lib\monoandroid80\Xamarin.Android.Support.Annotations.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Compat">
  <HintPath>..\packages\BiInc.Mobile.Framework.4.5.1.0\lib\monoandroid80\Xamarin.Android.Support.Compat.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Core.UI">
  <HintPath>..\packages\Xamarin.Android.Support.Core.UI.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.Core.UI.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Core.Utils">
  <HintPath>..\packages\BiInc.Mobile.Framework.4.5.1.0\lib\monoandroid80\Xamarin.Android.Support.Core.Utils.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.CustomTabs">
  <HintPath>..\packages\Xamarin.Android.Support.CustomTabs.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.CustomTabs.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Design">
  <HintPath>..\packages\Xamarin.Android.Support.Design.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.Design.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Fragment">
  <HintPath>..\packages\Xamarin.Android.Support.Fragment.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.Fragment.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Media.Compat">
  <HintPath>..\packages\Xamarin.Android.Support.Media.Compat.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.Media.Compat.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.Transition">
  <HintPath>..\packages\Xamarin.Android.Support.Transition.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.Transition.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v4">
  <HintPath>..\packages\Xamarin.Android.Support.v4.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.v4.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
  <HintPath>..\packages\Xamarin.Android.Support.v7.AppCompat.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.CardView">
  <HintPath>..\packages\Xamarin.Android.Support.v7.CardView.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.v7.CardView.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.MediaRouter">
  <HintPath>..\packages\Xamarin.Android.Support.v7.MediaRouter.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.Palette">
  <HintPath>..\packages\Xamarin.Android.Support.v7.Palette.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.v7.Palette.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.RecyclerView">
  <HintPath>..\packages\Xamarin.Android.Support.v7.RecyclerView.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Xamarin.Android.Support.v8.RenderScript, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Xamarin.Android.Support.v8.RenderScript.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.v8.RenderScript.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
  <HintPath>..\packages\Xamarin.Android.Support.Vector.Drawable.27.0.2.1\lib\MonoAndroid81\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
  <Private>True</Private>
</Reference>

And in my AndroidManifest.xml I have:

<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />

I know that this is not a build environment issue specific to my machine because we are using Microsoft's AppCenter service and I can reproduce these same exact build errors on their system.

I am considering rolling the support libraries back to an older version, but I am not sure if that would help or which version to roll back to.

I have noticed that the resources it is complaining about are referenced only in the auto-generated Resource.Designer.cs file. For example:

public const int TextAppearance_Compat_Notification_Info = 2131493267;
public const int TextAppearance_Compat_Notification_Info_Media = 2131493231;

I am not sure of the significance of that, but I am including it just in case.

In another post I found a possibly related issue: Error:resource style/TextAppearance.Compat.Notification.Info (aka {packageId}.test:style/TextAppearance.Compat.Notification.Info) not found

However setting the target SDK version to 26 did not fix the problem for me so I am guessing that there is something else going on here.

In case it matters, I am using Visual Studio Enterprise for Mac 7.6.3.

I have tried to construct an example project in order to reproduce the issue, but have not been able to so far.

Specifically, I would like to know whether anyone has run into these same missing resource errors when attempting to upgrade a Xamarin.Forms project to version 3.1 from an older version such as 2.5. Or maybe I am missing something obvious?

--- Update: As suggested below by SushiHangover, I have conducted a full dependency audit on the project. I have:

  1. Removed all dependencies from all sub-projects
  2. Added the version of Xamarin.Forms I wish to update to (3.1.0.697729, which is the current version)
  3. Carefully re-added each required package to the sub-projects that require them. As mentioned below, I was able to get rid of a lot of apparently unused dependencies. This put the Android support libraries at version 26.0.2, which is a few versions behind the current one.
  4. Verified that I am building against the latest android SDK.

I am back to the same 12 build errors as before. I'm not sure where to go from here. Along the way I created a series of git branches as possible restore points. I will next try adding some packages in a different order, in case it affects something.

lemessur
  • 114
  • 7
  • 2
    Remove **all** the packages first and then add the Xamarin.Forms package version that you are upgrading to and let that process install the Xamarin.Android dependancies, then add any other 3rd-party/in-house packages that your project is using. (Also make sure that your Xamarin.Android application project is "Compile" targeting the latest version.) – SushiHangover Sep 05 '18 at 18:30
  • Thank you! That has turned out to be a great idea anyway as it has allowed me to get rid of a lot of apparently unused packages. Unfortunately, certain packages I do need appear to depend on newer versions of the Android support libraries (version 26+), leading back to the original issue. I'll edit my post later today with more details on that. – lemessur Sep 06 '18 at 15:15

0 Answers0