Fuse getting crashed while integrate with Mapbox Android SDK

Hi,

I am integrating Mapbox iOS and Android SDK with Fuse. iOS integration is working properly but when I run an android project from Android Studio, Fuse is getting crash and I am not able to scroll in its log. Map is loading properly but Fuse is crashed. This is my Android code:

using Uno;
using Uno.UX;
using Uno.Time;
using Uno.Compiler.ExportTargetInterop;
using Fuse;
using Fuse.Controls;
using Fuse.Controls.Native;
using Fuse.Controls.Native.Android;

namespace Native.Android
{

	[Require("Gradle.Repository","mavenCentral()")]	
	[Require("Gradle.Dependency","compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.2@aar') { exclude module: 'support-v4' }")]

	extern(Android) public class MyMapBox : Fuse.Controls.Native.Android.LeafView, MyMapBoxView
	{
		NeonMapBoxDelegate _host;

		[UXConstructor]
		public MyMapBox([UXParameter("Host")]MyMapBoxDelegate host) : base(Create())
		{
			_host = host;			
		}

		void MyMapBoxView.AddAnnotation(object annotation)
		{

		}

		[Foreign(Language.Java)]
		static Java.Object Create()
		@{
                    return new CustomMapView(@(Activity.Package).@(Activity.Name).GetRootActivity());
		@}
	}
}

This is my CustomMapView class in Java

public class CustomMapView extends FrameLayout {
    
    private MapView mMapView;
    
    public CustomMapView(Context context) {
        super(context);
        addAllView(context);
    }

    void addAllView(Context context) {
        Mapbox.getInstance(context, "<Mapbox Key>");
        CameraPosition position = new CameraPosition.Builder()
        .target(new LatLng(42.5568, -105.9923)) // Sets the new camera position
        .zoom(13) // Sets the zoom to level 10
        .build(); // Builds the CameraPosition object from the builder
        MapboxMapOptions options = new MapboxMapOptions();
        options.camera(position);
        options.styleUrl(Style.OUTDOORS);
        mMapView = new com.mapbox.mapboxsdk.maps.MapView(context, options);
        this.addView(mMapView);
        ((MyMapBox) context).setContentView(this);
    }
}

Fuse is getting crashed but I am able to get this error in Android studio:

08-17 11:03:58.364 20789-20789/com.apps.mymapbox E/MyMapBox: Uno.Exception: Dictionary did not contain the given key
                                                                     at Uno.Collections.Dictionary`2.get_Item(TKey)
                                                                     at Fuse.Controls.TreeRenderer.Fuse.Elements.ITreeRenderer.Measure(Fuse.Elements.Element,Fuse.LayoutParams,float2&)
                                                                     at Fuse.Controls.NativeViewHost.Fuse.Elements.ITreeRenderer.Measure(Fuse.Elements.Element,Fuse.LayoutParams,float2&)
                                                                     at Fuse.Controls.Control.GetContentSize(Fuse.LayoutParams)
                                                                     at Fuse.Controls.LayoutControl.GetContentSize(Fuse.LayoutParams)
                                                                     at Fuse.Controls.Panel.GetContentSize(Fuse.LayoutParams)
                                                                     at Fuse.Elements.Element.InternGetContentSize(Fuse.LayoutParams)
                                                                     at Fuse.Elements.StandardBoxSizing.CalcArrangePaddingSize(Fuse.Elements.Element,Fuse.LayoutParams)
                                                                     at Fuse.Elements.Element.GetArrangePaddingSize(Fuse.LayoutParams)
                                                                     at Fuse.Elements.StandardBoxSizing.CalcMarginSize(Fuse.Elements.Element,Fuse.LayoutParams)
                                                                     at Fuse.Elements.Element.GetMarginSize(Fuse.LayoutParams)
                                                                    at Fuse.Layouts.DefaultLayout.GetElementsSize(Uno.Collections.IList<Fuse.Node>,Fuse.LayoutPa

Please tell me what’s this error and how can I fix it.

Hi,

This is a sample repo of project:

Hi Dhvl,
Sadly I don’t think this is possible right now in Fuse. The reason is that the Mapbox sdk seems to require a newer version of the support library than we are currently shipping.

I will open a ticket for us to update that but it will take a while as we have to make sure we dont break existing libraries using the older support libs. Theoretically it should be fine but we have hit issues with this on android before.

Sorry we dont have a decent answer for this but thankyou for raising the issue, I’ll get the ticket raised now.