AndroidX
AndroidX copied to clipboard
Parent class vtable failed to initialize, due to: VTable setup of type AndroidX.SwipeRefreshLayout.Widget.SwipeRefreshLayout
Version Information
- Visual Studio version (eg. 16.8 or 8.8): 16.10.4
- Xamarin.Android version (eg. 11.1): 5.0.0.2083
- Using AndroidX or Support Libraries: Xamarin.AndroidX.Core 1.6.0.1
Describe your Issue:
My android app crashes in Release mode, So I started to figure out why. Seems to be an issue with this package and the Linking Behavior set to "SDK only"
Parent class vtable failed to initialize, due to: VTable setup of type AndroidX.SwipeRefreshLayout.Widget.SwipeRefreshLayout failed assembly:Xamarin.AndroidX.SwipeRefreshLayout.dll type:SwipeRefreshLayout member:(null)

Steps to Reproduce (with link to sample solution if possible):
Enable "Linking Behavior" to "SDK only" and run the app on a real device. It crashes on startup with this exception.
Include any relevant Exception Stack traces, build logs, adb logs:
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00018] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:944
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00095] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/ReferenceSources/RuntimeType.cs:185
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) [0x00009] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/ReferenceSources/RuntimeType.cs:155
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) [0x00027] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/rttype.cs:5770
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00039] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/activator.cs:206
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/activator.cs:190
at System.Activator.CreateInstance (System.Type type) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/activator.cs:134
at Xamarin.Forms.ResourceDictionary+<>c.<SetAndLoadSource>b__11_0 (System.Type key) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\ResourceDictionary.cs:74
at System.Runtime.CompilerServices.ConditionalWeakTable`2[TKey,TValue].GetValue (TKey key, System.Runtime.CompilerServices.ConditionalWeakTable`2+CreateValueCallback[TKey,TValue] createValueCallback) [0x00033] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs:322
at Xamarin.Forms.ResourceDictionary.SetAndLoadSource (System.Uri value, System.String resourcePath, System.Reflection.Assembly assembly, System.Xml.IXmlLineInfo lineInfo) [0x00031] in D:\a\1\s\Xamarin.Forms.Core\ResourceDictionary.cs:74
at RemoteControlRepetierServer.Themes.LightTheme.InitializeComponent () [0x00012] in C:\RCP\Source\RCRepetierServer\RemoteControlRepetierServer\obj\Debug\netstandard2.1\Themes\LightTheme.xaml.g.cs:22
at RemoteControlRepetierServer.Themes.LightTheme..ctor () [0x00008] in C:\RCP\Source\RCRepetierServer\RemoteControlRepetierServer\Themes\LightTheme.xaml.cs:12
at RemoteControlRepetierServer.App.InitializeComponent () [0x00012] in C:\RCP\Source\RCRepetierServer\RemoteControlRepetierServer\obj\Debug\netstandard2.1\App.xaml.g.cs:22
at RemoteControlRepetierServer.App..ctor () [0x00047] in C:\RCP\Source\RCRepetierServer\RemoteControlRepetierServer\App.xaml.cs:65
at RemoteControlRepetierServer.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00027] in C:\RCP\Source\RCRepetierServer\RemoteControlRepetierServer.Android\MainActivity.cs:62
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00010] in /Users/builder/azdo/_work/2/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.App.Activity.cs:2973
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.5(intptr,intptr,intptr)
Duplicate of #343
Duplicate of #343
Yes, but the issue is closed, while it's not fixed. So I opened a new issue for it 👍🏻
Also experiencing this issue, runs fine on emulator but when I send it to AppCenter to be built with linking enabled, I see this same issue when the build is tested on a real device. That is with v1.6.0.1.
Please could you provide minimal repro sample?
Sorry for the late reply. I try to get a sample for you.
I experienced this issue as well. Discovered that all pages containing the ListView element would crash OnAppearing. Solutions which worked for me were:
- Utilizing a CollectionView instead.
- Or upgrading the Android target framework from v.11 to v.12
- &/or upgrading all AndroidX libraries within NuGet package manager to the latest (June 2022 release)
I have the same issue. My app was running OK, until I :
- Added Nuget Package Xamarin.AndroidX.Core, v1.8.0.1
- Added Nuget Package Xamarin.Firebase.Crashlytics, v118.2.1.6
- Increased TargetFrameworkVersion from v11.0 to v12.0
@ccsousa01 So my AndroidX library is latest and target framework is 12, and I have the crash.
This appears to have been fixed in a previous version: https://github.com/xamarin/AndroidX/issues/343