Is ApplicationComponent deprecated?
ApplicationComponent being renamed to SingletonComponent, to allow usage of Hilt in non-Android Gradle modules link
ApplicationComponent being renamed to SingletonComponent, to allow usage of Hilt in non-Android Gradle modules link
I had this issue after upgrading Kotlin to 1.5.20. Adding kapt.use.worker.api=false in gradle.properties worked for me the problem Checkout dagger issue Support for Kotlin 1.5.20
In alpha03, Use the new @HiltViewModel and the normal @Inject now as shown below. @HiltViewModel class MyViewModel @Inject constructor( private val repository: Repository, private val savedStateHandle: SavedStateHandle ) : ViewModel(), LifecycleObserver { // Some code }
I am late for the answer. I was also facing the same problem in Android Studio Bumblebee because of the new Gradle syntax for adding dependencies at the project level. For adding Dagger Hilt in project-level you can use the following syntax: id ‘com.google.dagger.hilt.android’ version ‘2.41’ apply false At the time of writing this, the … Read more
I guess you re missing this dependency kapt “com.google.dagger:hilt-android-compiler:2.28-alpha” *First add the plugin apply plugin: ‘dagger.hilt.android.plugin’ *Secondly add the dependencies // Dagger Core implementation “com.google.dagger:dagger:2.37” kapt “com.google.dagger:dagger-compiler:2.37” // Dagger Android api ‘com.google.dagger:dagger-android:2.37’ api ‘com.google.dagger:dagger-android-support:2.37’ kapt ‘com.google.dagger:dagger-android-processor:2.37’ // Dagger – Hilt implementation “com.google.dagger:hilt-android:2.37” kapt “com.google.dagger:hilt-android-compiler:2.37” *Thirdly add the classpath classpath “com.google.dagger:hilt-android-gradle-plugin:2.28-alpha” PS : if you re … Read more
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’
I just hit this problem this morning. Do you have anything in your build.gradle that adds arguments to the annotationProcessOptions? For example: android { … defaultConfig { … javaCompileOptions { annotationProcessorOptions { arguments = [“room.schemaLocation”: “$projectDir/schemas”.toString()] } } } } If so, try changing from “arguments =” to “arguments +=”, as just using equals overwrites … Read more
ApplicationComponent is Deprecated in Dagger Version 2.30 ApplicationComponent removed in Dagger Version 2.31 Alternatively SingletonComponent should be used instead of ApplicationComponent @Module @InstallIn(SingletonComponent::class) class RoomModule() { . . . }
Support for this use-case was removed in Retrofit2. The recommendation is to use an OkHttp interceptor instead. HostSelectionInterceptor made by swankjesse import java.io.IOException; import okhttp3.HttpUrl; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; /** An interceptor that allows runtime changes to the URL hostname. */ public final class HostSelectionInterceptor implements Interceptor { private volatile String host; public … Read more
Just use @ApplicationContext annotation on your context parameter. By annotating context with @ApplicationContext provided by Hilt, we don’t need to create a provider for the application context. import dagger.hilt.android.qualifiers.ApplicationContext /* For hilt versions lower than v2.28.2 use ApplicationComponent instead of SingletonComponent. ApplicationComponent is deprecated and even removed in some versions above v2.28.2 so better refactor … Read more