What is this error "Java.Lang.NoSuchFieldException: 'No field mDefaultTextColor in class..." ?

This happened after updating Xamarin.forms, installing the latest xamarin.forms.visuals.material and switching to VS 19 from 17. Target sdk is 28 with a minimum of 21. Happens while trying to navigate to a page.

Java.Lang.NoSuchFieldException
  Message=No field mDefaultTextColor in class Landroid/support/design/widget/TextInputLayout; (declaration of 'android.support.design.widget.TextInputLayout' appears in /data/app/...)

Best Answer

  • edited October 17 Accepted Answer

    I found that an older library that was being used in the project was causing the issue. Its called Xfx.Controls. It was being used on the Entry control in only one of the pages and I'm guessing it was using an old field "mDefaultTextColor".

    My fix was just to remove the library as I believe it has not been updated to support new Xamarin.Forms.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    First of all, Please check the all the nuget packages update to the same version like following screenshot.

    If you update the VS 19 from 17, then you open the previous project, please close your project, then open your project folders, delete the all of the bin and obj folders in the PCL , Android and IOS. In the end, re-open your project, rebuild your project, If this issue is still existed.

    If this issue is still existed, please upload your demo to here, If you just post a simple error, I cannot troubleshot this issue for further.

  • JimmyBarrientosJimmyBarrientos Member ✭✭
    edited October 17 Accepted Answer

    I found that an older library that was being used in the project was causing the issue. Its called Xfx.Controls. It was being used on the Entry control in only one of the pages and I'm guessing it was using an old field "mDefaultTextColor".

    My fix was just to remove the library as I believe it has not been updated to support new Xamarin.Forms.

Sign In or Register to comment.