question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ComponentProcessingStep was unable to process '*Application_HiltComponents.SingletonC'

See original GitHub issue

Build failed from version 2.41, can reproduce this issue on https://github.com/Goooler/DemoApp/pull/31.

> Task :app:hiltJavaCompileDailyDebug FAILED
error: ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.SingletonC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
  
  Dependency trace:
      => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.ActivityModule
      => element (METHOD): provideFactory(android.app.Activity,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
      => annotation: @dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
      => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
  
  If type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is on your classpath.
error: ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.ActivityRetainedC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
  
  Dependency trace:
      => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.ActivityModule
      => element (METHOD): provideFactory(android.app.Activity,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
      => annotation: @dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
      => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
  
  If type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is on your classpath.
error: ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.ActivityC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.SingletonC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.

  
  Dependency trace:
      => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.ActivityModule
      => element (METHOD): provideFactory(android.app.Activity,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
      => annotation: @dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
      => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
  
  If type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is on your classpath.
error: ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.FragmentC' because 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' could not be resolved.
  
  Dependency trace:
      => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.FragmentModule
      => element (METHOD): provideFactory(androidx.fragment.app.Fragment,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
      => annotation: @dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory
      => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory
  
  If type 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' is on your classpath.
4 errors

0 problems were found storing the configuration cache.

See the complete report at file:///Users/snebula/StudioProjects/DemoApp/build/reports/configuration-cache/popabyj1ftkzyogj54f7jaoh/bmgev1gjstvd3t2dbnqaodwzu/configuration-cache-report.html

ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.ActivityRetainedC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.

ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.ActivityC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.

ComponentProcessingStep was unable to process 'io.goooler.demoapp.DemoApplication_HiltComponents.FragmentC' because 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' could not be resolved.


Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

120reactions
noman3qaucommented, Mar 10, 2022

Removing the dependency on hilt-lifecycle-viewmodel causes the error to go away as it is no longer required in newer versions of hilt. Simply delete this line from your app level build.gradle file if you have it.

implementation ‘androidx.hilt:hilt-lifecycle-viewmodel:x.x.x’

43reactions
bcorsocommented, Feb 17, 2022

Hmm, the androidx.hilt:hilt-lifecycle-viewmodel artifacts were deprecated in the Dagger 2.34 release in favor of native Hilt API. The missing DefaultActivityViewModelFactory class is no longer in the Hilt codebase.

You should be able to fix this using the instructions in the 2.34 release notes to upgrade to the new HiltViewModel API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Dagger2 ComponentProcessor was unable to process
Based on Google documentation you can do this: 1- Add @HiltViewModel annotation to the class. 2- Replace the @ViewModelInject annotation on ...
Read more >
error ComponentProcessingStep was unable to process com ...
error: ComponentProcessingStep was unable to process 'com.ibot.cyrano.android.CyranoApplication_HiltComponents.SingletonC' because ...
Read more >
Error: ComponentProcessingStep was unable to process ...
Error: ComponentProcessingStep was unable to process 'com.example.eg.AppApplication_HiltComponents.SingletonC' because 'dagger.hilt.android.
Read more >
Dagger Hilt in Android with Example - GeeksforGeeks
So, to overcome this problem Hilt was introduced. Dagger Hilt simplifies the whole process and reduces the unnecessary steps without losing any ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found