Runtime errors on Android after updating ArcGISRuntime from 100.8 to 100.9 ("ArcGIS Runtime core library is inaccessible")

2061
2
Jump to solution
09-15-2020 11:56 AM
FelicityRhone
New Contributor III

Hi,


My team has a Xamarin Forms project (using Xamarin Forms 4.7.0.1239) using the ArcGIS .NET Runtime, which we are attempting to update from 100.8 to 100.9. The upgrade went pretty smoothly for iOS and UWP, but on Android we have an issue. The application builds successfully, but at runtime we get this error message when attempting to create a Portal for signing in (basically the first thing our app does):

System.TypeInitializationException: The type initializer for 'RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase' threw an exception. ---> System.Exception: Failed to initialize ArcGIS Runtime core. The ArcGIS Runtime core library is inaccessible. ---> System.DllNotFoundException: libRuntimeCoreNet assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_enableBreakOnException(bool,intptr&)
at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.EnableBreakOnException (System.Boolean enable) [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () [0x0007d] in <690269dd3d914be9b36ba5ea4ee75e34>:0
--- End of inner exception stack trace ---
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () [0x000db] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.OnBeforeFirstUseOfGeneratedWrapper () [0x00013] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..cctor () [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
--- End of inner exception stack trace ---
at RuntimeCoreNet.GeneratedWrappers.CorePortal..ctor (System.IntPtr handle) [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at RuntimeCoreNet.GeneratedWrappers.CorePortal..ctor (System.String uRL) [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.Portal.ArcGISPortal.CreateUnloadedPortal (System.Uri portalUri, System.Globalization.CultureInfo culture) [0x00010] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.Portal.ArcGISPortal.CreateAsync (System.Uri portalUri, System.Boolean loginRequired, System.Globalization.CultureInfo culture, System.Threading.CancellationToken cancellationToken) [0x00019] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at VertiGIS.Mobile.Modules.GenericApp.WelcomeViewModel.InitializeAgolPortalExtension () [0x00092] in <5da5ee6237484dd1afebfc6266c70a4d>:0
at VertiGIS.Mobile.Modules.GenericApp.WelcomeViewModel.ExecuteSignInToAgolAsync () [0x00087] in <5da5ee6237484dd1afebfc6266c70a4d>:0
[2020-09-14 13:57:01,920][ERROR] System.TypeInitializationException: The type initializer for 'RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase' threw an exception. ---> System.Exception: Failed to initialize ArcGIS Runtime core. The ArcGIS Runtime core library is inaccessible. ---> System.DllNotFoundException: libRuntimeCoreNet assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_enableBreakOnException(bool,intptr&)
at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.EnableBreakOnException (System.Boolean enable) [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () [0x0007d] in <690269dd3d914be9b36ba5ea4ee75e34>:0
--- End of inner exception stack trace ---
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () [0x000db] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.OnBeforeFirstUseOfGeneratedWrapper () [0x00013] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..cctor () [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
--- End of inner exception stack trace ---
at RuntimeCoreNet.GeneratedWrappers.CorePortal..ctor (System.IntPtr handle) [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at RuntimeCoreNet.GeneratedWrappers.CorePortal..ctor (System.String uRL) [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.Portal.ArcGISPortal.CreateUnloadedPortal (System.Uri portalUri, System.Globalization.CultureInfo culture) [0x00010] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.Portal.ArcGISPortal.CreateAsync (System.Uri portalUri, System.Boolean loginRequired, System.Globalization.CultureInfo culture, System.Threading.CancellationToken cancellationToken) [0x00019] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at VertiGIS.Mobile.Modules.GenericApp.WelcomeViewModel.InitializeAgolPortalExtension () [0x00092] in <5da5ee6237484dd1afebfc6266c70a4d>:0
at VertiGIS.Mobile.Modules.GenericApp.WelcomeViewModel.ExecuteSignInToAgolAsync () [0x00087] in <5da5ee6237484dd1afebfc6266c70a4d>:0

The error state only happens when the app is built by our Azure DevOps pipeline though; a co-worker and I are both able to build and run it without any issues when doing a release build locally from Visual Studio. We haven't had this issue on the build server for 100.8 or any earlier versions of the ArcGIS runtime.
I have ensured that the build server and my local machine have the same version of Visual Studio 2019 (version 16.7.3), Android build tools (29.0.2) and Java SDK (1.8.0.25). One difference is that my machine is Windows 10 and the build server is Windows Server 2012.

I added a call to Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize() when the app loads and get the same kind of error with a shorter stack trace which may also be helpful:

Error in init: System.Exception: Failed to initialize ArcGIS Runtime core. The ArcGIS Runtime core library is inaccessible. ---> System.DllNotFoundException: libRuntimeCoreNet assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_enableBreakOnException(bool,intptr&)
at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.EnableBreakOnException (System.Boolean enable) [0x00000] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () [0x0007d] in <690269dd3d914be9b36ba5ea4ee75e34>:0
--- End of inner exception stack trace ---
at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () [0x000db] in <690269dd3d914be9b36ba5ea4ee75e34>:0
at VertiGIS.Mobile.Viewer.MainActivity+<>c__DisplayClass0_0.<OnCreate>g__onLoadHandler|0 (System.Object sender, System.EventArgs args) [0x00054] in <43f0ca9a6fdd48b7b38d1f4a384cefd4>:0

I saw a similar issue posted on GitHub: https://github.com/Esri/arcgis-runtime-samples-dotnet/issues/722, and ensured that we don't have x86 or x86_64 support enabled in our release builds as suggested there.

We've tested this on multiple Android devices, including a Galaxy A8 (Android 9), Pixel 2 XL (Android 9), and the Galaxy Tab S6 Lite (Android 10).

Any suggestions for how to resolve this?

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

In the Android project, could you try and add an explicit reference to the Esri.ArcGISRuntime.runtimes.Android nuget package and see if that addresses the issue? `NuGet Gallery | Esri.ArcGISRuntime.runtimes.Android 100.9.0 `

I saw a similar issue posted on GitHub: https://github.com/Esri/arcgis-runtime-samples-dotnet/issues/722, and ensured that we don't have x86 or x86_64 support enabled in our release builds as suggested there.

That should no longer be an issue, as we currently support those architectures. If you select an architecture not supported, you'd get a build error now.

View solution in original post

2 Replies
dotMorten_esri
Esri Notable Contributor

In the Android project, could you try and add an explicit reference to the Esri.ArcGISRuntime.runtimes.Android nuget package and see if that addresses the issue? `NuGet Gallery | Esri.ArcGISRuntime.runtimes.Android 100.9.0 `

I saw a similar issue posted on GitHub: https://github.com/Esri/arcgis-runtime-samples-dotnet/issues/722, and ensured that we don't have x86 or x86_64 support enabled in our release builds as suggested there.

That should no longer be an issue, as we currently support those architectures. If you select an architecture not supported, you'd get a build error now.

FelicityRhone
New Contributor III

Hi Morten,
Cool, that seems to have fixed it! Thank you for the suggestion.

0 Kudos