Cannot find symbol CrimeDao

I’m getting an error when compiling the Criminal Intent app after adding the database (p223 in the book). I’m pretty sure this is caused by me mistyping something, but I can’t find it. The error I get is below: can anyone offer any advice about how to resolve this? Note that the error is detected in the autogenerated java file, not the kotlin source.

/Users/kae/AndroidStudioProjects/CriminalIntent/app/build/tmp/kapt3/stubs/debug/com/bignerdranch/android/criminalintent/database/CrimeDatabase.java:11: error: cannot find symbol
public abstract CrimeDao crimeDao();
^
symbol: class CrimeDao
location: class CrimeDatabase/Users/kae/AndroidStudioProjects/CriminalIntent/app/build/tmp/kapt3/stubs/debug/com/bignerdranch/android/criminalintent/CrimeRepository.java:8: error: cannot find symbol
private final CrimeDao crimeDao = null;
^
symbol: class CrimeDao
location: class CrimeRepository/Users/kae/AndroidStudioProjects/CriminalIntent/app/build/tmp/kapt3/stubs/debug/com/bignerdranch/android/criminalintent/database/CrimeDatabase.java:8: error: [RoomProcessor:MiscError] androidx.room.RoomProcessor was unable to process this class because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.

I’m really struggling with this. I’ve checked the code multiple times and I can’t see any error. Can anyone suggest where to look to resolve this?

The error highlighted is in the generated code, not the code I have entered:

Thank you.

I’ve fixed this problem, but uncovered another.

The issue was caused because I had “import CrimeDao” at the top of CrimeDatabase.kt. Android Studio prompts to add that, but (with hindsight) it’s clearly wrong.

Now the problem I have is:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
   > java.lang.reflect.InvocationTargetException (no error message)

More detail:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptDebugKotlin'.
[...]

Caused by: org.jetbrains.kotlin.kapt3.base.util.KaptBaseError: Exception while annotation processing
	at [...]

Caused by: kotlin.KotlinNullPointerException
	at [...]

Can anyone shed light on this?

Have you discovered the cause of this issue? I am experiencing the same errors.