Resource.Designer.cs conflict

RenaudRenaud FRMember ✭✭

Hi everybody!

I recently migrated to VS2019 a big VS Solution from VS2017
the APP build from VS2017 works fine and is in production for a while.

Architecture :
ProjectA : Android.Xamarin App (XF 4.2.0.848062)
ProjectB : Android.xamarin libray (with resource.designer)
ProjectC : Android.xamarin libray (with resource.designer)
ProjectD : AAR binding Project (including jar, resources, xml,...)

Project Mapping :
ProjectD is referenced in ProjectB and resouces from AAR file are well included in designer.cs
ProjectC is referenced in ProjectB
ProjectB is referenced in Project A

Build is OK but I get errors at runtime :

Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f0e002a

if I search for #0x7f0e002a in entire solution I find several matches

but none of them refer to the same resource, ie :

In resource.designer.cs in Project B
// aapt resource value: 0x7F09002A
public static int buttonCOR = 2131296298;

In resource.designer.cs in Project A
// aapt resource value: 0x7F09002A
public const int center_horizontal = 2131296298;

and it is not the only one example.

How could I resolve this conflict ?
I tried to clean project,
I tried to delete resource.designer.cs content
Same issue from another computer.

Please Help :smile:

Microsoft Visual Studio Community 2019
Version 16.4.0 Preview 1.0
Xamarin 16.4.000.22 ([email protected])
Xamarin Designer 16.4.0.150 (remotes/origin/[email protected])
Xamarin Templates 16.4.1 (1b802f7)
Xamarin.Android SDK 10.0.99.100 (d16-4/7ae91c2)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 12.16.1.24 (08809f5)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    In resource.designer.cs in Project B
    // aapt resource value: 0x7F09002A
    public static int buttonCOR = 2131296298;

    In resource.designer.cs in Project A
    // aapt resource value: 0x7F09002A
    public const int center_horizontal = 2131296298;

    Did you try to change the another name of center_horizontal? then rebuild your project If this issue is existed.

    Please check all of nuget packages versions are the same version.

  • RenaudRenaud FRMember ✭✭

    After many clean, vs restart, ...

    I took my APK and used Android studio to Analyse it

    in resources.arsc section there is plenty of Resource Types anim,..., array,....id, ....string
    I found
    center_horizontal in id Types

    buttonCOR in string Types

    unfortunately buttonCOR needs to be in Id types

    buttonCOR is part of a layout xml
    this xml is embedded in the AAR file (in binding project)

    Works well with VS2017

  • RenaudRenaud FRMember ✭✭

    Hello again

    If I build only ProjectA

    The resource.desinger.cs file is well formed and I can retrieve ButtonCOR in source code .

    If I deploy my app the value is overwritten by center_horizontal

    center_horizontal come from different nugets

    global::Plugin.Hud.Resource.Id.center_horizontal = global::MobileShop.Droid.Resource.Id.center_horizontal;
    global::Xamarin.Forms.Platform.Android.Resource.Id.center_horizontal = global::MobileShop.Droid.Resource.Id.center_horizontal;
    global::XLabs.Forms.Resource.Id.center_horizontal = global::MobileShop.Droid.Resource.Id.center_horizontal;

    I'm stuck

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    If you move your project to another PC, If you have this issue.

  • RenaudRenaud FRMember ✭✭
    Yes,
    Issue is the same on another PC.
Sign In or Register to comment.