ArcGIS Runtime 100.2.1 does not work with Xamarin Forms and Android 4.2.2

4836
13
Jump to solution
03-21-2018 06:23 AM
SandeepKuniel1
New Contributor III

We have been trying to put the basic .net sample on the Leica Zeno 20 UMTS having android Android 4.2.2.
Trying to open a simple "Display Map" page....gives this error.
System.NotSupportedException: Could not activate JNI Handle 0x2b00025 (key_handle 0x4113f7e8) of Java type 'md525ae7a30145b6936c079fc7426298397/DisplayMap' as managed type 'ArcGISRuntimeXamarin.Samples.DisplayMap.DisplayMap'.

We have even tried on the emulator with android 4.2.2.

Any help would be appreciated!

 

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

OK I tracked down the bug, and will manifests itself on devices at API Level 16 and Level 17 (ie v4.2 and down).

Luckily I have a workaround for you. In the Application constructor add the following line:

 Java.Lang.JavaSystem.LoadLibrary("runtimecore");

Let me know if that works for you or not.

View solution in original post

13 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Android 4.2.2 is currently supported with ArcGIS Runtime SDK for .NET v100.2.1. For that error, it sounds like you might be running into Could not activate JNI Handle — Xamarin Forums ?

Note the next release of ArcGIS Runtime SDK for .NET will increase the minimum required Android version to API level 19 / 4.4. For more information see Release notes for 100.2.1—ArcGIS Runtime SDK for .NET (WPF) | ArcGIS for Developers 

Cheers

Mike

0 Kudos
SandeepKuniel1
New Contributor III

Thank you for the reply Michael.

But, it still does not work for 100.2.1 and Android 4.2 - API 17, I have tried it on emulator as well as the device.

Attached is a simple example to replicate the issue.

0 Kudos
dotMorten_esri
Esri Notable Contributor

There's nothing that stands out to be wrong with the app from my first look. Do you see a similar issue when using the native android version? (it not Xamarin.Forms) ?

0 Kudos
SandeepKuniel1
New Contributor III

Thank you Morten, i can give it a try.
But that would not help us much. Since, our app has been developed using Xamarin and Leica Zeno 20 UMTS is one of those devices which plan to use it on.

0 Kudos
dotMorten_esri
Esri Notable Contributor

First I was trying to trouble-shoot, and figure out if the issue is isolate to Xamarin.Forms for Android, or also exist in Xamarin.Android.

Both will be able to run just fine on an Android device (Forms is just an extension of Xamarin.Android). In fact if you're only targeting Android and not building a cross-platform app, I'd recommend using the native UI stack instead of Forms, as you should see faster load times and more control of the UI.

0 Kudos
SandeepKuniel1
New Contributor III

Hi Again Morten,

Let me try to summarize what works and what does not.

Xamarin.Forms.Android (Android API 17, 4.2.2 with custom/esri.github xamarin sample)---Crashes

Xamarin.Forms.Android (Android API 23, with custom/esri.github xamarin sample)---Works

Xamarin.Android (Android API 17, 4.2.2 with custom/esri.github xamarin sample)---Crashes

Xamarin.Android (Android API 23, with custom/esri.github xamarin sample)---Works

We already have an app created using xamarin forms and works nicely on android and ios, except for the above mentioned leica device, just for fun i tried installing the collector app in the leica device and works like a charm. So now, i am not sure what could be going wrong here....

Would prefer, if you could try out a simple test using the 4.2 SDK and if it works do send me the code, then i can drill further.

Regarding your suggestion on the faster loading & UI, we have already done quite a lot of work on the forms and is relatively stable on the both the platforms.

For the mapping part we have a single instance of the mapview with snapshot of the operational layers.....once this is loaded for the first time, this object gets  attached/detached in different layouts..which considerably reduces the load time on each pages.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Thank you. That's very helpful. Collector is relying on the same native bits but isn't built on Xamarin. That seems to indicate the issue is with either Microsoft's Xamarin or our Runtime Xamarin bits. We'll dig more into reproducing.

Which emulator were you using?

0 Kudos
SandeepKuniel1
New Contributor III

That'c nice, have tried it on the connected leica device as well as on the following emulator

Nexus 4/Jelly Bean (Android 4.2 x86)

0 Kudos
dotMorten_esri
Esri Notable Contributor

Good news! I actually managed to track down a Leica Zeno 20 with Android 4.2 on it, and I can reproduce the issue. Time to do some digging...

0 Kudos