NAXAM / mapboxnavigationui-android-binding

Xamarin.Android binding library - Mapbox Navigation SDK
MIT License
2 stars 5 forks source link

"Application has stopped" error while initializing MapboxNavigation #1

Open BoogieMAN2K opened 6 years ago

BoogieMAN2K commented 6 years ago

I'm initializing the MapboxNavigation class during the OnCreate method and after the line gets executed android is returning me this message. The thing is, the navigation is getting created correctly and everything works fine after that but the Application output doesn't return any message or trace related and I don't know how to fix this issue.

This is the related code, JIC...

` MapboxNavigation navigation; NavigationMapRoute navigationMapRoute;

    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.HomeActivity);

        Initialize(savedInstanceState);

        this.ViewModel.OnLocationChanged += ViewModel_OnLocationChanged;
        this.ViewModel.OnSetDestination += ViewModel_OnSetDestination;

        navigation = new MapboxNavigation(this, Mapbox.AccessToken);
    }

` Any help would be greatly appreciated...

BoogieMAN2K commented 6 years ago

To add more information about the crash, I'm using MvvmCross and using LogCat the device return this:

Error (21218) / AndroidRuntime: FATAL EXCEPTION: main Error (21218) / AndroidRuntime: Process: com.Tackzee_Rider:lost, PID: 21218 Error (21218) / AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for void md50ba1a21c88855965b540681eb0c3b913.MainApplication.n_onCreate() (tried Java_md50ba1a21c88855965b540681eb0c3b913_MainApplication_n_1onCreate and Java_md50ba1a21c88855965b540681eb0c3b913_MainApplication_n_1onCreate__) Error (21218) / AndroidRuntime: at md50ba1a21c88855965b540681eb0c3b913.MainApplication.n_onCreate(Native Method) Error (21218) / AndroidRuntime: at md50ba1a21c88855965b540681eb0c3b913.MainApplication.onCreate(MainApplication.java:34) Error (21218) / AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118) Error (21218) / AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5817) Error (21218) / AndroidRuntime: at android.app.ActivityThread.-wrap1(Unknown Source:0) Error (21218) / AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677) Error (21218) / AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105) Error (21218) / AndroidRuntime: at android.os.Looper.loop(Looper.java:164) Error (21218) / AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6567) Error (21218) / AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) Error (21218) / AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) Error (21218) / AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

tuyen-vuduc commented 6 years ago

@BoogieMAN2K

Error message is very clear

No implementation found for void md50ba1a21c88855965b540681eb0c3b913.MainApplication.n_onCreate()

Plz make sure your application class is written correctly.

MvvmCross won't impact this binding library.

Cheers.

tuyen-vuduc commented 6 years ago

@BoogieMAN2K Haven't heard back from you. Is that ok now?

MAX-POLKOVNIK commented 6 years ago

@tuyen-vuduc Hello again!

I got same java.lang.UnsatisfiedLinkError exception when I call LostLocationEngine.Activate() or others LostLocationEngine methods.

There is my sample: TestMapbox2Naxam.zip

Application class is written correctly and works when app starts.

I guess Android throws exception due to Mapzen starts service in another process. Generated AndroidManifest contains this line:

<service android:name="com.mapzen.android.lost.internal.FusedLocationProviderService" android:process=":lost" />

So, I google this problem and found this https://bugzilla.xamarin.com/show_bug.cgi?id=51940.

Any ideas how to fix this?

DarkFIxED commented 6 years ago

+1, have same problem. Any progress?

sillerjp commented 6 years ago

+1 Error happens in the MapboxCoreNavigation library, if someone has a workaround I'll appreciate it. Been trying to somehow get around this issue, it only happens the first time the MapboxNavigation object is instantiated. I'm using my own binding with the latest MapboxNavigation library and getting the same error so I don't think it has to do with this binding library but the actual mapbox native one.

sillerjp commented 6 years ago

Hi,

I hope this can help, in my case the error happens because I have a custom class for MainApplication which inherits from Application, Application.IActivityLifecycleCallbacks. On this class I have an override for OnCreate (which still calls base.OnCreate).

If I remove this override I stop getting the error. It seems that the MapzenLost process gets confused by having this OnCreate override. I'm also using GoogleLocationEngine instead of LostLocationEngine. I've never been able to make LostLocationEngine work with LocationLayerPlugin.

tipa commented 5 years ago

@JPSiller Experiencing the same issue (with another library binding). Have you ever found a solution/workaround to this problem?

andremorata commented 5 years ago

I was experiencing the exact same problem which weirdly started apparently from nothing. So, after almost 4 hours looking into this, I have decided to move the code from OnCreate() method to the ctor() based on @JPSiller comment and now the problem is gone. I still need to test a little bit more, but at least the app is able to start correctly now.