Open GrahamBorland opened 3 years ago
I think this is due to our processors trying to process an element within a file facade, which we currently don't support.
For example, this would be the case if you had an annotation that we process on a top-level method, like:
// File: Foo.kt
// Invalid top-level usages of @Inject
@Inject fun invalidInjectMethod(str:String) {}
// Valid usage of @Inject within class
class Foo {
@Inject fun validInjectMethod(str:String) {}
}
Thanks for bringing this up. We should provide a better error message here.
@bcorso Thanks, that helped me track down my error. I'd left an @Inject
field hanging loose in a file alongside a bunch of @Composable
functions.
@Inject
internal lateinit var viewModelFactory: ViewModelProvider.Factory
Dagger 2.40 (also happens with 2.39.1) Kotlin 1.5.31
I'm getting this crash. I'm trying to add Dagger injection to a Gradle library module which includes an AAC ViewModel. It's very probable I'm doing something wrong (I've been working through a series of Dagger-related build failures), but I don't think it should be causing the Dagger compiler to crash. 😄
What other info would be useful?
Full error log with stacktrace (gist)