Category : dagger-hilt

In my dagger graph, I need to provide okhttp with proxy. I am using java.net.InetSocketAddress with java.net.Proxy which causes network on main thread exception. @InstallIn(SingletonComponent::class) @Module class SingletonModule { @Provides fun proxyClient(): OkHttpClient { return OkHttpClient.Builder() .proxy( Proxy(Proxy.Type.HTTP, InetSocketAddress("192.9.09.8", 98)) ).callTimeout(2, TimeUnit.MINUTES).build() } } Suspend function doesn’t seems to work with hilt. Is there a ..

Read more

i have problem and really don’t know how to fix this. I try to find similar posts several days, but didn’t find. I use retrofit for parsing api and put it in room database and use rxjava3 because it will be asynchronously That my JSON {"coord":{"lon":-0.1257,"lat":51.5085},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"base":"stations","main":{"temp":22.78,"feels_like":22.81,"temp_min":21.23,"temp_max":23.92,"pressure":1020,"humidity":65},"visibility":10000,"wind":{"speed":0.45,"deg":264,"gust":2.68},"clouds":{"all":75},"dt":1623415339,"sys":{"type":2,"id":2019646,"country":"GB","sunrise":1623383015,"sunset":1623442617},"timezone":3600,"id":2643743,"name":"London","cod":200} Api service interface OpenWeatherApiService { @GET("weather") fun getCurrentWeather( ..

Read more

I’m trying to do according to the documentation, but the WorkManager crashes even before the doWork method manifest <provider android:name="androidx.work.impl.WorkManagerInitializer" android:authorities="${applicationId}.workmanager-init" tools:node="remove" /> application @HiltAndroidApp class MonitoringApp : Application(), Configuration.Provider { @Inject lateinit var workerFactory: HiltWorkerFactory override fun getWorkManagerConfiguration(): Configuration { return Configuration.Builder() .setWorkerFactory(workerFactory) .build() } } worker @HiltWorker class UploaderWorker @AssistedInject constructor( @Assisted appContext: ..

Read more

I’m following the documentation, but the WorkManager crashes even before the doWork method manifest <provider android:name="androidx.work.impl.WorkManagerInitializer" android:authorities="${applicationId}.workmanager-init" tools:node="remove" /> application @HiltAndroidApp class MonitoringApp : Application(), Configuration.Provider { @Inject lateinit var workerFactory: HiltWorkerFactory override fun getWorkManagerConfiguration(): Configuration { return Configuration.Builder() .setWorkerFactory(workerFactory) .build() } } worker @HiltWorker class UploaderWorker @AssistedInject constructor( @Assisted appContext: Context, @Assisted workerParams: WorkerParameters, ..

Read more

I am working on a project where I have implemented Dagger Hilt + Retrofit + Coroutine. But after a new update of dependencies of dagger hilt, the project is not able to run. I am getting this error for the activities and fragments in which I have implemented Dagger and Viewmodels with Dependency Injection. Earlier ..

Read more