Information about my environment
- Mac OS Big Sur: 11.4
- VS for Mac: 8.10.6 (Build 10)
- Xamarin.Android: 11.3.0.4
- SDK Tools Version: 26.1.1
- SDK Platform Tools Version: 31.0.2
- SDK Build Tools Version: 31.0.0 rc5
- microsoft_dist_openjdk_1.8.0.25 1.8.0-25
- Xamarin.Forms: 5.0.0.2012
- Xamarin.Forms.Visual.Material: 5.0.0.2012
- Xamarin.Google.Android.Material: 1.2.1.1
Additional Information
- Using AndroidX libraries
- No references to
Xamarin.Android.Support.Design
- Cleaned Solution many times Manually
- Deleted All bin and obj folders multiple times and reset Visual Studio several Times
- Target Framework: 10.0 (Q)
Issue:
I was able to build and deploy to my device but when the app runs and loads a login page, during InitializeComponent()
call, the following exception is thrown:
ERROR: System.TypeLoadException: Parent class vtable failed to initialize, due to: VTable setup of type AndroidX.SwipeRefreshLayout.Widget.SwipeRefreshLayout failed assembly:/data/data/com.app.dev/files/.override/Xamarin.AndroidX.SwipeRefreshLayout.dll type:SwipeRefreshLayout member:(null) at (wrapper managed-to-native) System.RuntimeTypeHandle.type_is_assignable_from(System.Type,System.Type) at System.RuntimeTypeHandle.CanCastTo (System.RuntimeType type, System.RuntimeType target) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System/RuntimeTypeHandle.cs:265 at System.RuntimeType.IsAssignableFrom (System.Type c) [0x00020] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/rttype.cs:3809 at Xamarin.Forms.VisualTypeConverter.Register (System.Reflection.Assembly assembly, System.Collections.Generic.Dictionary`2[TKey,TValue] mappings) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\Visuals\VisualTypeConverter.cs:64 at Xamarin.Forms.VisualTypeConverter.InitMappings () [0x0001a] in D:\a\1\s\Xamarin.Forms.Core\Visuals\VisualTypeConverter.cs:22 at Xamarin.Forms.VisualTypeConverter.ConvertFromInvariantString (System.String value) [0x00007] in D:\a\1\s\Xamarin.Forms.Core\Visuals\VisualTypeConverter.cs:119
Below is the xaml from the page being loaded:
<ContentPage x:Class="SignInPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:effects="clr-namespace:XF.Core.Effects;assembly=XF.Core"
x:Name="SignInPage"
IsBusy="{Binding IsBusy, Mode=OneWay}"
Visual="Material"
mc:Ignorable="d">
<ContentPage.Content>
<StackLayout
x:Name="ContentStackLayout"
Margin="0"
Padding="0"
AutomationId="ContentStackLayout"
BackgroundColor="White"
HorizontalOptions="FillAndExpand"
Orientation="Vertical"
VerticalOptions="FillAndExpand">
<Grid
x:Name="MainContentGrid"
Margin="0,0,0,0"
AutomationId="MainContentGrid"
ColumnSpacing="0"
HorizontalOptions="FillAndExpand"
RowSpacing="0"
VerticalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition>
<RowDefinition.Height>
<OnIdiom
x:TypeArguments="GridLength"
Phone="50"
Tablet="60" />
</RowDefinition.Height>
</RowDefinition>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="8" />
</Grid.ColumnDefinitions>
<Image
x:Name="HeaderGradientImage"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="6"
Aspect="Fill"
AutomationId="HeaderGradientImage"
HorizontalOptions="Fill"
Source="{Binding HeaderGradientBackgroundImageUrl}"
VerticalOptions="Fill" />
<Label
x:Name="TitleLabel"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="6"
AutomationId="TitleLabel"
Style="{Binding HeaderTitleWhiteLabelStyle}"
Text="{Binding Title}" />
<Image
x:Name="LogoImage"
Grid.Row="0"
Grid.Column="4"
Aspect="AspectFit"
AutomationId="LogoImage"
HorizontalOptions="End"
Source="{Binding LogoIconUrl}"
VerticalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding AppLogoTappedCommand}" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<StackLayout
x:Name="SignInStackLayout"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="6"
AutomationId="SignInStackLayout"
HorizontalOptions="FillAndExpand"
Orientation="Vertical">
<StackLayout.VerticalOptions>
<OnIdiom
x:TypeArguments="LayoutOptions"
Phone="CenterAndExpand"
Tablet="StartAndExpand" />
</StackLayout.VerticalOptions>
<StackLayout.Margin>
<OnIdiom
x:TypeArguments="Thickness"
Phone="15,0,15,0"
Tablet="50,75,50,0" />
</StackLayout.Margin>
<Label
x:Name="PleaseLogInLabel"
Margin="0,7,0,0"
AutomationId="PleaseLogInLabel"
FontSize="Large"
HorizontalOptions="Start"
Text="Please Log In"
TextColor="#002D72"
VerticalOptions="Center" />
<Label
x:Name="UserIdLabel"
Margin="0,15,0,0"
AutomationId="UserIdLabel"
FontSize="Small"
Text="USER ID"
TextColor="#002D72"
VerticalOptions="Center">
<Label.WidthRequest>
<OnIdiom
x:TypeArguments="x:Double"
Phone="200"
Tablet="320" />
</Label.WidthRequest>
</Label>
<Frame
x:Name="UserIdFrame"
Margin="0,0,0,0"
AutomationId="UserIdFrame"
BackgroundColor="White"
BorderColor="#002D72"
Padding="0,0,0,0">
<Entry
x:Name="UserIdEntry"
Margin="0,0,0,0"
AutomationId="UserIdEntry"
BackgroundColor="White"
FontSize="Medium"
Keyboard="Text"
Placeholder="User"
PlaceholderColor="#BBBBBB"
Text="{Binding UserId, Mode=TwoWay}"
TextChanged="UserIdEntry_TextChanged"
TextColor="#002D72"
VerticalOptions="Center"
Visual="Material">
<Entry.WidthRequest>
<OnIdiom
x:TypeArguments="x:Double"
Phone="200"
Tablet="320" />
</Entry.WidthRequest>
<Entry.Effects>
<effects:CgEntryCapitalizeKeyboardEffect />
</Entry.Effects>
</Entry>
</Frame>
<Label
x:Name="PasswordLabel"
Margin="0,5,0,0"
AutomationId="PasswordLabel"
FontSize="Small"
Text="Password"
TextColor="#002D72"
VerticalOptions="Center">
<Label.WidthRequest>
<OnIdiom
x:TypeArguments="x:Double"
Phone="200"
Tablet="320" />
</Label.WidthRequest>
</Label>
<Frame
x:Name="PasswordFrame"
Margin="0,0,0,0"
AutomationId="PasswordFrame"
BackgroundColor="White"
BorderColor="#002D72"
Padding="0,0,0,0">
<Entry
x:Name="PasswordEntry"
Margin="0,0,0,0"
AutomationId="PasswordEntry"
BackgroundColor="White"
FontSize="Medium"
IsPassword="true"
Keyboard="Text"
Placeholder="Desktop Password"
PlaceholderColor="#BBBBBB"
Text="{Binding Password, Mode=TwoWay}"
TextChanged="PasswordEntry_TextChanged"
TextColor="#002D72"
VerticalOptions="Center">
<Entry.WidthRequest>
<OnIdiom
x:TypeArguments="x:Double"
Phone="200"
Tablet="320" />
</Entry.WidthRequest>
</Entry>
</Frame>
<Label
x:Name="DomainLabel"
Margin="0,5,0,0"
AutomationId="DomainLabel"
FontSize="Small"
Text="Domain"
TextColor="#002D72"
VerticalOptions="Center">
<Label.WidthRequest>
<OnIdiom
x:TypeArguments="x:Double"
Phone="200"
Tablet="320" />
</Label.WidthRequest>
</Label>
<Frame
x:Name="NetworkDomainPickerFrame"
Margin="0,0,0,0"
AutomationId="NetworkDomainPickerFrame"
BackgroundColor="White"
BorderColor="#002D72"
Padding="0,0,0,0">
<Picker
x:Name="NetworkDomainPicker"
Margin="0,0,0,0"
AutomationId="NetworkDomainPicker"
BackgroundColor="White"
Title="Select Network Domain"
FontSize="Medium"
ItemDisplayBinding="{Binding Name}"
ItemsSource="{Binding NetworkDomainList}"
TitleColor="#BBBBBB"
SelectedIndexChanged="NetworkDomainPicker_SelectedIndexChanged"
SelectedItem="{Binding SelectedNetworkDomain, Mode=TwoWay}"
TextColor="#002D72"
VerticalOptions="Center">
<Picker.WidthRequest>
<OnIdiom
x:TypeArguments="x:Double"
Phone="200"
Tablet="320" />
</Picker.WidthRequest>
</Picker>
</Frame>
<Button
x:Name="SignInButton"
Margin="0,15,0,0"
AutomationId="SignInButton"
BackgroundColor="#056DAE"
Command="{Binding SignInCommand}"
FontSize="Medium"
IsEnabled="{Binding IsFormEntryValid}"
Text="Log In"
TextColor="White">
<Button.HeightRequest>
<OnIdiom
x:TypeArguments="x:Double"
Phone="40"
Tablet="50" />
</Button.HeightRequest>
</Button>
<BoxView
x:Name="ViewHeaderSeparatorBoxView"
Margin="0,15,0,15"
AutomationId="ViewHeaderSeparatorBoxView"
BackgroundColor="#CCCCCC"
HeightRequest="2"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
<ScrollView x:Name="DisclaimerScrollView" AutomationId="DisclaimerScrollView">
<StackLayout Orientation="Vertical">
<Label
x:Name="DisclaimerLabel"
Margin="0,0,0,0"
AutomationId="DisclaimerLabel"
FontSize="Small"
HorizontalOptions="StartAndExpand"
Text="{Binding SignInDisclaimerText}"
TextColor="#53565A"
VerticalOptions="StartAndExpand" />
<Label
x:Name="DisclaimerLabel"
Margin="0,20,0,0"
AutomationId="DisclaimerLabel"
FontSize="Micro"
HorizontalOptions="CenterAndExpand"
LineBreakMode="WordWrap"
Text="{Binding SignInDisclaimerText}"
TextColor="#53565A"
VerticalOptions="EndAndExpand" />
</StackLayout>
</ScrollView>
</StackLayout>
</Grid>
</StackLayout>
</ContentPage.Content>
</ContentPage>