mapzen/on-the-road_android

Class not found exception

zepatrik opened this issue · 8 comments

D/Error: ERR: stack=java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
at com.mapzen.valhalla.Router$Type.<init>(Router.kt:6)
at com.mapzen.valhalla.Router$Type.<clinit>(Router.kt:7)
at com.mapzen.valhalla.ValhallaRouter.<init>(ValhallaRouter.kt:23)
 ...
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-support-annotations-23.2.1_08193b53b960544c120f26d084314af1812ccb3b-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-internal_impl-23.2.1_d5c039ffb2458e75c50ea1c65219701417979b58-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-cup-v1.0.0_b4171d3b19d74686ef0c68209abfae0ff0926a71-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.2.1_ba2d46157d708676f43b2b97b977bd717459c7da-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-com.android.support-support-v4-23.2.1_4757a30a6805cc7cadfab00b510e98d43e2841f9-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-com.android.support-recyclerview-v7-23.2.1_f7446b42cacbfae0c7a5d5ae5921f3e4bd720e52-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-com.android.support-design-23.2.1_39c41fbaedd067ff976f95c76da06a66823c9252-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.2.1_7ea6ba08bafc9055b54092a7d4ad4a1f46b899fa-classes.dex", dex file "/data/data/org.zepatrik.dielisaapp/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.2.1_58ab5605734446e51dc905d60f2a369a2957a3cc-classes.dex"],nativeLibraryDirectories=[/vendor/lib, /system/lib, /vendor/lib, /system/lib]]
                                                                    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                    at com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:90)
                                                                    at java.lang

I get this error using the ValhallaRouter as suggested in the README.md, do I have to add any other package? Seems to be missing this: kotlin.jvm.internal.Intrinsics

It looks like the Kotlin standard library is not getting transitively included in your project. Try removing the @aar from the end of the dependency in your build.gradle (that probably shouldn't be there). Or you can try keeping the @aar and specify transitive = true.

  compile 'com.mapzen:on-the-road:0.8.1'

OR

  compile('com.mapzen:on-the-road:0.8.1'@aar) {
    transitive = true;
  }

Let me know if either of these changes work and I can update the docs.

So doing the first approach fixed the problem, thanks a lot
Now I get the error 207, but I'm searching the source for the cause of this

Docs fixed here #68.

@dgearhart do you know in which scenarios Valhalla would return a 207? Could it be API key related?

@ecgreb not from valhalla
maybe apiaxle - rate limit? @baldur any insights?

the api doesn't return a 207 in any scenario that I know of

So I found this

var gson: Gson = Gson();
        routingService.getRoute(gson.toJson(getJSONRequest()).toString(),
                API_KEY,
                object : retrofit.Callback<String> {
                    override fun failure(error: RetrofitError?) {
                        callback?.failure(207)
                    }

                    override fun success(result: String, response: Response) {
                        callback?.success(Route(result))
                    }
                })

Its in ValhallaRouter.kt, line 125
But I don't know what it means...

I think the error was API-key related, because now it doesn't occure, I used a freshly created key last time and didn't test in between at all

But another question, wy aren't you using fragments so you could retain an instance of the Router, or am I supposed to write a wrapping fragment by my self?

Nice catch. I'm not sure why 207 is hardcoded there. Could be some legacy code from when we used OSRM or from a previous app (this library was originally extracted from an old app we were building).

As for saving state yes you should use your own fragment if you want the Router instance to persist.