NonExistentClass cannot be converted to Annotation

后端 未结 3 1656
Happy的楠姐
Happy的楠姐 2021-01-21 16:15

I added a new Retrofit interface to my project containing a couple of Endpoints annotated with the @GET and @HEADERS annotations, after Injecting said

3条回答
  •  温柔的废话
    2021-01-21 17:17

    Luckily this question led me to figure out my issue. While moving around classes from an app module into a library, I was referencing an annotation class which only existed in a debug folder. So debug builds were fine, but calls to gradlew install failed when generating release files.

    The error for me was very explicit although it took me a long time to realize - the generated file had literally replaced the missing annotation with @error.NonExistentClass()

    Moving the file into the main src set meant both debug and release builds could see the class. What took me a while to figure out was that I assumed this was a Dagger issue being masked by kapt, but really it was just a regular old Dagger issue. My advice is to look at your Dagger setup carefully.

提交回复
热议问题