Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError for BindingContextFactory in MapboxDirections.java #908

Closed
danesfeder opened this issue Oct 29, 2018 · 6 comments
Closed

Comments

@danesfeder
Copy link
Contributor

Seeing this in crash logs, it seems there's some sort of issue resolving the BindingContextFactory.

Fatal Exception: java.lang.NoClassDefFoundError
Failed resolution of: Lcom/sun/xml/internal/ws/spi/db/BindingContextFactory;
    com.mapbox.api.directions.v5.MapboxDirections.errorDidOccur (MapboxDirections.java:194)
    com.mapbox.api.directions.v5.MapboxDirections.access$000 (MapboxDirections.java:60)
    com.mapbox.api.directions.v5.MapboxDirections$1.onResponse (MapboxDirections.java:146)
    retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run (ExecutorCallAdapterFactory.java:70)

When navigating to MapboxDirections.java in the Navigation SDK codebase I see:
screen shot 2018-10-29 at 9 20 15 am

@osana @zugaldia could this be some sort of dependency conflict in the navigation repo?

@zugaldia
Copy link
Member

zugaldia commented Oct 29, 2018

@danesfeder I think this is related to a ProGuard setting that we cannot include in this project (because it's a pure Java project) but that @tobrun recently added to the Maps SDK with mapbox/mapbox-gl-native#13103. Could you try with a nav build including that ProGuard rule, or not using ProGuard at all?

@danesfeder
Copy link
Contributor Author

@zugaldia ah okay thank you - I'll give that a shot!

@danesfeder
Copy link
Contributor Author

@Guardiola31337
Copy link
Contributor

@zugaldia @danesfeder the dontwarn Proguard rule doesn't fix this - actually, it hides it until it crashes at runtime. This was introduced by #758 and #765

The problem here is that we're using a class (BindingContextFactory - I guess it's included in some JDKs) which is not available on Android. So when the exception is thrown at runtime Android is not able to find that class and 💥

We should ensure that we use a logger that's available in Android. I'll cut a PR using the Java Logger (that should be available in Android) instead of using BindingContextFactory from sun library. After fixing this I believe that Proguard rule won't be necessary anymore so we'll need to remove it from the different projects in which is included (I'll remark this in the PR).

BTW this is duplicate of #852 so I'm going to go ahead and close here.

Thanks for flagging!

@osana
Copy link
Contributor

osana commented Oct 29, 2018

@Guardiola31337 I agree that it is very easy to get rid of BindingContextFactory. I just do it. There is no good reason to use BindingContextFactory.

@osana
Copy link
Contributor

osana commented Oct 29, 2018

@danesfeder @Guardiola31337
#909 will address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants