1
java.lang.NullPointerException
    at org.jetbrains.android.dom.navigation.NavigationSchema$TypeRef.<init>(NavigationSchema.java:183)
    at org.jetbrains.android.dom.navigation.NavigationSchema.lambda$buildDestinationTypeToDestinationMap$2(NavigationSchema.java:531)
    at java.util.HashMap.forEach(HashMap.java:1288)
    at org.jetbrains.android.dom.navigation.NavigationSchema.buildDestinationTypeToDestinationMap(NavigationSchema.java:531)
    at org.jetbrains.android.dom.navigation.NavigationSchema.init(NavigationSchema.java:460)
    at org.jetbrains.android.dom.navigation.NavigationSchema.createIfNecessary(NavigationSchema.java:389)
    at com.android.tools.idea.naveditor.surface.NavDesignSurface.lambda$tryToCreateSchema$3(NavDesignSurface.java:370)
    at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$0(DumbService.java:79)
    at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$1(DumbService.java:123)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:977)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
    at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:116)
    at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:79)
    at com.android.tools.idea.naveditor.surface.NavDesignSurface.tryToCreateSchema(NavDesignSurface.java:368)
    at com.android.tools.idea.naveditor.surface.NavDesignSurface.lambda$goingToSetModel$0(NavDesignSurface.java:278)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

错误太长,这里就不贴了,所以我只贴错误的第一页。当我在 android studio 3.4.2 中打开具有空的默认启动代码 navigation.xml 文件的 android 项目时,IDE 会显示警报,即发生 IDE 错误。但是我的项目同步成功,我不能做的是在设计选项卡中打开导航,它显示“等待构建完成”。

4

1 回答 1

0

只是不要使用空文件,而是将根节点添加到其中:

<?xml version="1.0" encoding="utf-8"?>
<navigation
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    app:startDestination="@id/someFragment"
    android:id="@+id/nav_graph">

</navigation>
于 2019-07-22T15:30:44.897 回答