mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
622 stars 319 forks source link

InstructionView not being rendered in LayoutPreview #3555

Open carstenhag opened 4 years ago

carstenhag commented 4 years ago

Android API: Mapbox Navigation SDK version: 1.0.0-rc7 of both normal and ui sdk.

Steps to trigger behavior

  1. Include com.mapbox.navigation.ui.instruction.InstructionView in a layout
  2. Build project
  3. Layout Preview fails to render layout, as somewhere something uses ConnectionPool, which shouldn't be done when isInEditMode().

Expected behavior

InstructionView preview renders with static/sample data, showing the customized colors

Actual behavior

Class can not be instantiated and therefore can't be previewed.

java.lang.NoClassDefFoundError: Could not initialize class okhttp3.internal.concurrent.TaskRunner
    at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:41)
    at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:47)
    at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.kt:445)
    at com.mapbox.navigation.ui.instruction.GuidanceViewImageProvider.<init>(GuidanceViewImageProvider.kt:36)
    at com.mapbox.navigation.ui.instruction.InstructionView.<init>(InstructionView.java:130)
    at com.mapbox.navigation.ui.instruction.InstructionView.<init>(InstructionView.java:180)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:403)
    at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:186)
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:144)
    at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:309)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:416)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:427)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:331)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1123)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1097)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:501)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:348)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:404)
    at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:141)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:678)
    at com.android.tools.idea.rendering.RenderTask.lambda$inflate$8(RenderTask.java:809)
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Guardiola31337 commented 4 years ago

cc @JunDai @abhishek1508 for visibility

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

carstenhag commented 3 years ago

Still relevant