gpt4 book ai didi

安卓导航图

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:55:55 24 4
gpt4 key购买 nike

使用 Android Studio Canary 3.2 中的新导航图。我遇到了导航图的视觉效果无法呈现的问题。显示屏显示“正在等待构建完成...”我尝试过重建、清理,甚至卸载并重新安装 Android Studio。似乎没有什么可以解决的。有人有运气吗? (我收到以下 IDE 错误。)

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)

最佳答案

偶然发现了一个解决方案。

  1. 首先,删除navigation controller的gradle依赖,以及代码中所有的使用。
  2. 删除资源中的导航文件夹。
  3. 确保 gradle 同步成功。
  4. 重启 Android Studio。
  5. 右键单击 res 文件夹,创建新资源。将其命名为 nav_graph,选择资源类型 - 导航。 AS 提供下载所需的依赖项,按是。
  6. 享受导航 Controller 。

请注意,这个序列对我来说不是第一次就有效,如果仍然失败,请重试。

编辑:在添加其他导航 Controller 依赖项(ui 和导航测试)并重新启动 AS 后,出现了同样的错误。经过一个小实验后,我找到了罪魁祸首——它是依赖性 androidTestImplementation“android.arch.navigation:navigation-testing-ktx:$navigationVersion”。只是在退出 AS 之前不要使用它或注释它,在启动它后取消注释。

关于安卓导航图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50613011/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com