-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] Cannot upgrade to XF 5.0.0.1874 Failed linking resource file textend is incompatible with attribute gravity #13303
Comments
@PureWeen: |
@developer9969 Where does this generated XML come from? |
|
@hartez @PureWeen I had a mixture of Android.Support libraries and AndroidX but I did not have any nuget package that uses material. However I have fixed the issue by running the AndroidX Migrator and noticed that it replaced all the support with AndroidX equivalent but more importantly I think the one that made the difference was as below. Xamarin.Android.Support.Design in fact because it removed support.Design the code below now uses uses Xamarin.Google.Android.Material
In conclusion obviously something has drastically changed in 5 and the error given was not helpful but your mentioning of androidX made me try the migrator which fixed the issue and highlight the problem. It compiles now I have to check if things still work :) thanks for replying |
@mattleibow ? Any thoughts? |
@PureWeen @mattleibow @hartez As soon as upgraded to 5 the solution not longer builds and I get "failed linking file resources" see pic above in the thread that is just an android library that we use , to fix it I had
However the main solution we get
No sure where the above is coming from... some linking attribute is going wrong. Workaround Has something changed in regards to using Xamarin.Android.Support.Design and AndroidX? Can both live together? unfortunately till some of the nuget we use dont update we are stuck with both!!! Does the above give enough to go on? many thanks |
After Clean Solution and Rerun. It work fine.. |
@haiduong741 hi there, I deleted bin/obj too but does not go away for me . we are STUCK now, just hope it gets prioritized |
It only run OK one time. Error still appear again. I have tried a repo but it run ok with XF 5.0. Only my company's project error... |
@PureWeen @hartez @mattleibow I have attached a small repo (see intial post) just build the solution and you should see the error. this is stopping us upgrading, Is this something for the Android Team? Hopefully you will get the time to look into this one. Many thanks |
You can try on 5.0.0.1791-pre5 version, it solved this my issue but 5.0.0.1874 still got problem. |
@dphamsafetrust hi interesting but that is an old version not a new one.Do you have same issue as I do? |
Exactly same :) |
@dphamsafetrust problem is it does not seems to be in the list of items they are working on for 5.01 and we will never be able to upgrade until is fixed or someone suggests a workaround. |
Pls answer or attach a solution for this. @hartez |
@developer9969 hi there we have exactly the same issue .Any news or workaround? @PureWeen @hartez any suggestions? many thanks |
This happens with my project as well |
Hi there we love xamarin and we would like to upgrade to the latest , we totally get it that you are very busy as there many bugs raised daily but I think the inability to upgrade to the latest code is quite important. Could someone from the Xamarin team reply to this thread? |
@developer9969 sorry if I've missed some steps but what do I do with your sample to reproduce? I downloaded it and it's running fine for me. I also removed all of the support and androidx packages and it still ran fine for me. @haiduong741 @gabsterdev1 @BYES-PA do you have repros? |
@haiduong741 @gabsterdev1 @BYES-PA @developer9969 @dphamsafetrust
If that still doesn't work can you install this tool here to create a binlog of your build and then attach that here? |
@haiduong741 There are multiple problems there. The first problem is you have a reference for a 25.4.0.2 v7 support library, you also have references for v7 28.0.0.3. Those all need to be the same 28.0.0.3 version. However, that is not your fundamental problem. Bottom LineThe bottom line is anything that starts with Xamarin.Android.Support.xxx cannot be used with Xamarin.Forms 5 or later. You want to set your target SDK to Android 10 (or later) and all your dependencies to use AndroidX libraries. To further clarify this, here is a screenshot of the Xamarin.Forms 5.+ dependencies: Path Forward - Migrating to Xamarin.Forms 5.0You need to do a couple things, Microsoft has explained them in the following articles:
To get a little headstart, you can use the automatic migrator tool: Then run it on the Android project I recommend what @developer9969 did. Start clean and slowly add in the dependencies you need. Only do this after you followed the guidance in the two documentation articles. Further AssistanceThe problem you are having is unrelated to the topic in this GitHub Issue. So that we don't continue to add off-topic content to the original problem here, please open a new issue on Microsoft Q & A instead of replying here. https://docs.microsoft.com/en-us/answers/topics/dotnet-xamarinforms.html Ping me on Twitter after you create the post, I will continue to assist you on Microsoft Q&A https://twitter.com/lancewmccarthy |
@PureWeen We have identified the problem, it is a conflict of object types in the As a quick public example, imagin you defined the following in the native Android project's attrs.xml (notice format is set to
However, take a look at one of the attributes being used in the lastest version of
this is what we believe is breaking the build in Telerik UI for Xamarin's case. I am going to email you directly so I can share portions of our private code and introduce you to one of the devs on the team. As far as @developer9969 original problem, I suspect there is also a similar problem with Thanks! |
@LanceMcCarthy Excellent explanation, however I did not know that
I have some apps that have a mix of support and Androidx set with a target of Android10 and they compile and I dont have any errors. My understanding is that at build time it will Swap them to AndroidX and dont have to be all AndroidX. (Of course we want to use AndroidX) Below is an extract from the doc you referenced. Am I missing the obvious? Just read you recent finding. FINALLY . Thanks |
You are correct, the bindings should get compiled for AndroidX, but that is assuming the process does a perfect discovery and match. This is mostly to help the transition for projects using libraries that haven't been updated with AndroidX dependencies yet (the transistive part of the puzzle). In the case of Lunk's project, since he's already going to be fixing a bunch PackageReferences list, might as well keep things as clean/simple as possible and put in the AndroidX packages now. Especially when you can just let the XF 5.0 package by itself (and let the nuspec dependencies list do the heavy lifting). |
thanks you for your time in answering . I spent at least 3 full working days on this issue. Very very frustrating. Again, brilliant explanation |
I has been fixed problem after update XF 5.0.1931 and remove v7 reference. |
I have some good news and bad news.
Problem ExplanationThe fundamental issue is if there are two attributes with the same name, but use different value types, the Android compiler will throw an error. This not an issue with the Xamarin, but the native Android side of things. As a simplified example, let's say you have (or are using) a library that has a custom attribute named "MyThing" and it is a numeric type (i.e. float). Then, lets say Google's Material library comes along at a later time and adds its own "MyThing" attribute... However, this attribute is of type string. Here's what I just explained in Table to make it more clear
The compiler is going to come along and see that any values set to the Google Material's MyThing value is not a float. So, you would get an error that looks like:
SolutionsThe options I am currently aware of (there may be more, I am not an expert in aapt2):
I hope this helps! Note: @developer9969 Whomever owns the library that contains the gravity attribute needs to be notified of this, they can rename the custom attributes, which should prevent future issues. |
@LanceMcCarthy hi there the clashing I was having was nothing todo with a third party library but with then I had other errors that were solved by cleaning up no longer used Android.Support.Library |
@LanceMcCarthy I'm facing the issue even just scaffold an XF project and just update XF and essentials. As soon as I add telerik ui for xamarin it can't build because of the mentioned error of '5dp.. verticalOffset' and so on.
UPDATE: |
@nziosys That looks like the class library project's packages. The problem is in the Android project's packages. Please check the Android project's .csproj and review it against my working version above. |
@LanceMcCarthy Thanks for the realy fast answer! |
We have a permanent fix coming out in the next release (within a week or two). In the meantime, the lib that causes the conflict is the Chart. IF you're not using the chart, then use other sub-packages instead (i.e. Telerik.UI.for.Xamarin.DataControls) |
Hi all, |
To help prevent any confusion, let me take a moment to explain the package names: The However, until we release the next version with the fix for Chart, you will need to only use the packages for the controls you need. For example, if you are using RadListView, you would install |
FYI - We have released a new internal build of Telerik.UI.for.Xamarin that contains the fix. Install
If you already have Telerik.UI.forXamarin installed, the hotfix will appear as an available update. If you are starting fresh, search for the package name. Here's a screenshot |
This is definitely a problem with a clash between Xamarin.Android.Support libraries and Xamarin.AndroidX & Xamarin.Android.Google.Material libraries, and an issue with the AndroidX automatic migration. XF 5.0.x has a dependency on Android10, which requires the AndroidX libraries. The automatic migration tool is supposed to map the support libraries onto the correct AndroidX libraries so you don’t have to do any manual changes to call, but Xamarin doesn't guarantee it will work and recommend making the required manual changes to shift from the Android support libraries to AndroidX. If you don’t explicitly reference the Android Support NuGets and instead reference them via the Xamarin.Forms package reference, then everything should be fine. Upgrading the XF NuGet should sort out the references correctly (however you may still find issues in your Android project if the auto conversion has issues, but unless you have a lot of XA stuff in there, any issues should be easy to fix). However, if you have explicit package references to Xamarin.Support NuGets these must be removed. Either let the XF Nuget pull in the Android Libraries by reference or add in the correct AndroidX Libraries manually (via Nuget or by editing the csproj file):
Of course, this doesn’t mean that any third party libraries you use wont be impacted. Here’s the ridiculous thing though. The latest version of VS2019 (16.8.5) has out of date templates for Android and Forms projects! The Android template references Android 9, instead of 10 or 11, and includes references to the old Xamarin.Android.Support packages! The Forms template references an old version of XF, which in turn references the old Xamarin.Android.Support packages, however at least with this they are package references so upgrading XF sorts out the issue. |
Hi Lance, Thanks for your efforts on this thus far. Whilst the hotfix package did fix the type error described in this thread, I did notice that the LoadOnDemand feature of RadListView subsequently stopped working. I've had to downgrade Xamarin.Google.Android.Material to v1.1.0.5 and use the latest stable release of Telerik UI v2021.1.119.1 which restored the functionality.
Is this also on your teams radar by any chance? |
@mshuf I have escalated this to the dev team directly. So that we don't mix topics, lets continue the LoadOnDemand conversation here https://feedback.telerik.com/xamarin/1508021-android-automatic-loadondemand-stopped-working-for |
All conflicts between native Telerik UI for Xamarin's native styles and Google new Material styles, are fixed in today's official release.
|
I created a new android project and added all the files used in the failed project. Then I setted the project to target android 10 and use the Migrate to AndroidX, added the required NuGet packages (Palette and Media) and everything compiled again |
Good morning dear. Thanks to everyone who contributed by sharing their problems and their solutions regarding this issue. Below are the steps that solved the problem for me following tips and recommendations shared here and in other posts: 1 - Updated Xamarin.Forms to version 5.0.0.2012 (done initially) After the last step the build was successful. |
I am also facing same issue, |
Hi, what developer should do who are having Telerik 2019 subscription only and do not require to update it, will they not be able to use Xamarin 5.0+ features including Hot Reload just because of Telerik issue ? In nuget package manager I am not getting Telerik packages above 2019. In that can what should I do ? please suggest me |
Hi, it sounds like your license expired in 2019 (a license gives you support for 1 year -minimum 6 releases: 3 major & 3 minor). If you want a new version, such as a new release in 2021 or 2022, you need to renew your license. This Microsoft thread is not the appropriate place for this conversation as we're talking solely about the Telerik controls. Please take the following steps so that the folks at Progress Software (aka Telerik) we can help:
Edit - To respond to your comment about "not be able to use XF 5 features". Yes, if the base framework has a newer set of minimum requirements, then any 3rd party with those dependencies must also match that minimum version (i.e. you cannot use XF 4.x Android SDK targets with XF 5.x higher minimum Android SDK targets). Almost every major release comes with some breaking changes, but the jump to AndroidX (Android 10) was a big one that requires a recompilation using the AndroidX SDK features. It isn't backwards compatible. You'll even see this across almost every Xamarin.Forms library, including Microsoft's packages (e.g. no more Xamarin.Android.Support.v4 kind of stuff) |
Hi
Excited to upgrade to XF 5 stable but as soon as I compile my solution my android project fails with 2 errors
Error 1 (probably linked to error 2)
Severity Code Description Project File Line Suppression State
Error failed linking file resources.
Error 2
verity Code Description Project File Line Suppression State
Error 'textEnd' is incompatible with attribute iconGravity (attr) flags [start=1, textStart=2] [weak].
MyCompany.Mobile.droid D:\Work\MyCompany.Mobile.droid\obj\Debug\100\lp\136\jl\res\layout\mtrl_calendar_month_navigation.xml 33
the problem is that this code is autogenerated so there is nothing I can do
I also tried to add a nuget Xamarin.Google.Android.Material to see if it solves the problem but doesnt.
Reverted to 4.8.0.1560 and all good again, Hopefully someone can look at it or advise a workaround.
Thanks!
`
<!--
`
Reproduction
SampleXF5.zip
The text was updated successfully, but these errors were encountered: