4

Using the new Navigation Graph in Android Studio canary 3.2. I've run into the problem where the visual of the nav graph will not render. The display says "Waiting for build to finish..." I've tried rebuilding, cleaning, even uninstalled & reinstalled Android Studio. Nothing seems to fix it. Anyone have any luck? (I get the following IDE error.)

null java.lang.IllegalStateException at com.android.tools.idea.naveditor.scene.decorator.NavSceneDecoratorFactory.(NavSceneDecoratorFactory.kt:39) at com.android.tools.idea.naveditor.scene.NavSceneManager.getSceneDecoratorFactory(NavSceneManager.java:510) at com.android.tools.idea.common.scene.SceneComponent.(SceneComponent.java:116) at com.android.tools.idea.common.scene.SceneManager.createHierarchy(SceneManager.java:164) at com.android.tools.idea.naveditor.scene.NavSceneManager.createHierarchy(NavSceneManager.java:265) at com.android.tools.idea.common.scene.SceneManager.update(SceneManager.java:121) at com.android.tools.idea.naveditor.scene.NavSceneManager.requestRender(NavSceneManager.java:340) at com.android.tools.idea.common.surface.DesignSurface.requestRender(DesignSurface.java:1291) at com.android.tools.idea.naveditor.surface.NavDesignSurface.layoutContent(NavDesignSurface.java:227) at com.android.tools.idea.common.surface.DesignSurface.setScale(DesignSurface.java:730) at com.android.tools.idea.common.surface.DesignSurface.setScale(DesignSurface.java:683) at com.android.tools.idea.common.surface.DesignSurface.zoom(DesignSurface.java:571) at com.android.tools.idea.naveditor.surface.NavDesignSurface.zoom(NavDesignSurface.java:402) at com.android.tools.idea.common.surface.DesignSurface.zoom(DesignSurface.java:513) at com.android.tools.idea.common.surface.DesignSurface.zoomToFit(DesignSurface.java:631) at com.android.tools.idea.naveditor.surface.NavDesignSurface.refreshRoot(NavDesignSurface.java:521) at com.android.tools.idea.naveditor.surface.NavDesignSurface.getCurrentNavigation(NavDesignSurface.java:233) at com.android.tools.idea.naveditor.scene.NavSceneManager.getRoot(NavSceneManager.java:241) at com.android.tools.idea.common.scene.SceneManager.update(SceneManager.java:115) at com.android.tools.idea.naveditor.scene.NavSceneManager.requestRender(NavSceneManager.java:340) at com.android.tools.idea.common.surface.DesignSurface.requestRender(DesignSurface.java:1291) at com.android.tools.idea.naveditor.surface.NavDesignSurface.layoutContent(NavDesignSurface.java:227) at com.android.tools.idea.common.surface.DesignSurface.addModel(DesignSurface.java:310) at com.android.tools.idea.common.surface.DesignSurface.setModel(DesignSurface.java:368) at com.android.tools.idea.common.editor.NlEditorPanel.initNeleModelOnEventDispatchThread(NlEditorPanel.java:162) at com.android.tools.idea.common.editor.NlEditorPanel.lambda$null$4(NlEditorPanel.java:149) at com.intellij.openapi.project.DumbServiceImpl.lambda$smartInvokeLater$7(DumbServiceImpl.java:430) at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:732) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:779) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:720) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:395) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

3
  • What helped for me - although thats absolutely not a great solution - was recrrating the project. Commented May 30, 2018 at 21:14
  • Dang, I tried deleting the .idea file and re-importing it into studio and it still didn't work.... Commented May 31, 2018 at 12:52
  • I guess trying to recreate the project will be your rescue :/ Commented May 31, 2018 at 19:20

1 Answer 1

4

Stumbled upon a solution accidentally.

  1. First of all, delete gradle dependencies of navigation controller as well as all the usages of it in code.
  2. Delete navigation folder in resources.
  3. Make sure gradle sync is successful.
  4. Restart Android Studio.
  5. Right click on res folder, create new resource. Name it nav_graph, select resource type - navigation. AS offers to download needed dependencies, press yes.
  6. Enjoy the navigation controller.

Note that this sequence worked for me not from the first time, retry if it still fails.

Edit: after adding other navigation controller dependencies (ui and navigation testing) and restarting the AS, same bug occurred. After a small experiment I have found the culprit - it is dependency androidTestImplementation "android.arch.navigation:navigation-testing-ktx:$navigationVersion". Just do not use it yet or comment it before exiting AS, uncomment after starting it.

Sign up to request clarification or add additional context in comments.

1 Comment

I commented it out, restarted, and it's back! Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.