Hi all, has anyone else run into unit tests failing on
app:hiltJavaCompileDebugUnitTest
step when adding
@HiltAndroidApp
to an Application?
We migrated from Dagger to using Hilt, and suddenly even an example basic empty unit test is failing trying to build the HiltAndroidApp but it's confusing b/c the unit tests shouldn't need Hilt and we're not testing a class that is using Hilt. Thanks!
Error:
Copy code
error: cannot find symbol return DaggerApplication_HiltComponents_SingletonC.builder()
^
symbol: variable DaggerApplication_HiltComponents_SingletonC
c
Colton Idle
05/06/2022, 12:03 AM
I can try tomorrow. Going out on a limb, but have you tried a new project with hilt to see if you get the same error. It'd at least rule out that it's an issue with your codebase
🙏 1
l
Lauren Yew
05/06/2022, 3:03 PM
Yes we have tried that, noticed that other projects with Hilt when running the
app:hiltJavaCompileDebugUnitTest
step, return
NO_SOURCE
and skip the step. No idea why our project is running the step...
Lauren Yew
05/09/2022, 8:29 PM
Fixed! Issue was we had HiltAndroidApp specified for our application, but the gradle module it was in was specified as an android library not an android app with
apply plugin: 'com.android.library'
. We could have fixed it by changing the module to be an android app with
apply plugin: 'com.android.application'
, but instead we moved the
@HiltAndroidApp
annotation out into our actual application gradle module.