Questions tagged [dagger]
Dagger is a dependency injection library for Java and Android.
1,487
questions
0
votes
0
answers
11
views
Get provides from another scope
There is an Android application Jetpack Compose. Dagger2 is used for DI (v2.45).
1. The following scopes are available:
@Scope
annotation class AppScope
@Scope
annotation class ...
0
votes
0
answers
24
views
I have this error after updating to android studio Giraffe: cannot find implementation RecipeDataBase_Impl does not exist
AndroidRuntime com.solution E FATAL EXCEPTION: main
Process: com.solution, PID: 11392
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.solution/com.solution....
1
vote
1
answer
44
views
Upgrading GWT version 2.7.0 to 2.10.0 causes issues
After upgrading gwt to 2.10.0 and upgrading mvn.compiler.version to 1.8.0 from 1.7.0 following errors are occuring:
On testing phase
log4j:WARN Error during default initialization
java.lang....
0
votes
0
answers
16
views
In Android, can the backgrounded app be destroyed, but foreground service still active
I understand that activities may be freed up. But what about Dagger singleton objects created (associated with AppComponent which is tied to Application context)? Can they be freed up as well but ...
0
votes
0
answers
21
views
room database multi instance in aar
There is an SDK A in which the Room is located
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Module
class DatabaseModule {
@Provides
@Singleton
@CustomDatabase
fun provideAnalyticsDatabase(...
0
votes
1
answer
35
views
Unresolved reference DaggerApplicationComponent when trygin to build app component
I'm usign Android Studio 2022.3.1 Patch 2, I'm trying to create my app component, but Dagger does not generate my app component. Here it is the MainApplication.kt
class MainApplication : Application()...
0
votes
1
answer
62
views
Using multiple @Assisted with same type
I'm using Dagger Assisted in my ViewModel. When I create my ViewModel with a single @Assisted parameter of the same type, it works fine. However, problems arise when there is more than one @Assisted ...
0
votes
2
answers
145
views
Android ViewModel has no zero argument constructor, Kotlin Jetpack Compose
I am trying to make an app with API calls, but when I launch, it crashes with error, searched all over the Internet and couldn't find whats wrong.
Here is an error:
*Caused by: java.lang....
0
votes
0
answers
128
views
Given component holder MainActivity does not implement interface GeneratedComponent or interface GeneratedComponentManager
I am strugling with hiltViewModel for some reason. I went many similar posts but with no success and I'm getting frustrated slowly, maybe you will find something that I've overseen.
The trouble begins ...
0
votes
0
answers
13
views
Hello, am trying to run an android project wiritten in Kotlin and am having an issue resolving builder() in DaggerAppComponent.builder().create(this)
These are my imports
build.gradle
`
// Dagger dependencies
def dagger_version = "2.40"
implementation "com.google.dagger:dagger:$dagger_version"
implementation "...
0
votes
0
answers
46
views
Execution failed for task ':app:kaptDebugKotlin' after trying to run code in Android Studio
Im trying to run a code, the code worked before but now its just not compiling, after formatting PC, I am getting this error log:
FAILURE: Build failed with an exception.
* What went wrong:
Execution ...
3
votes
2
answers
284
views
Android Dagger ComponentProcessingStep was unable to process
I'm trying to upgrade older version project to support SDK 33 and getting this error while compile.
error: ComponentProcessingStep was unable to process 'com.irokotv.dagger.AppComponent' because 'com....
0
votes
1
answer
83
views
Unable to instantiate application "com.company.application" java.lang.ClassNotFoundException: Didn't find class "com.company.application"
I was trying to build an application that uses Dagger Hilt following a tutorial.
I was checking whether the app is working after setting up a list of objects from API but then I kept getting a ...
0
votes
1
answer
33
views
Dagger2 custom scopes: Are custom scopes not seen on @Inject constructor injections when using provider methods in a module?
The following is the code
Custom Annotation classes:
@Qualifier
@Retention(AnnotationRetention.RUNTIME)
annotation class CtxMain
@Scope
@Retention(AnnotationRetention.RUNTIME)
annotation class ...
0
votes
0
answers
42
views
Java AWS Lambda - Avoid passing context too far down tree of calls
I used Dagger to inject dependencies on a Java Lambda:
public class LambdaEntryPointHandler implements RequestHandler<SQSEvent, SQSBatchResponse> {
private final Handler handler;
public ...
2
votes
1
answer
121
views
Crash when the screen needs to be recreated, possible problem with dependency injection (Class has no zero argument constructor)
I'm working on an old Android project. I know a little about Android, but my focus is iOS. So maybe I'm missing something simple here.
Problem:
The Home screen is working, but when it needs to be ...
0
votes
1
answer
38
views
Android provide from hilt
How I can make transfer parameter from fragment to dagger module used hilt?
I would like that
@Module
@InstallIn(SingletonComponent::class)
class TestModule {
@Singleton
@Provides
fun ...
0
votes
0
answers
87
views
dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved- Android Kotlin
Detail Error
ComponentProcessingStep was unable to process 'com.example.daggerhilt.BaseApp_HiltComponents.SingletonC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' ...
0
votes
1
answer
74
views
Dagger error: repeats modules with scoped bindings or declarations:
I keep trying to solve this error. And i have no idea what to do. I have 3 subcomponents(astronomy, currentweather and weatherforecast), I also created scopes and modules for each. With an App and ...
0
votes
2
answers
72
views
android.app.Activity cannot be provided without an @Provides-annotated method
I am trying to implement inapp-updates, I’ve Activity which has a ViewModel I added a method to it to “checkAppUpdates” which invokes “CheckAppUpdateUseCase” which take AppUpdateManager as a ...
1
vote
0
answers
29
views
Manage feature based hilt custom scope
My app is built with a Single Activity and it is feature-based multi-module. All UI is built using composable.
I want to create a custom scope for feature A. When the feature's journey is completed, ...
0
votes
0
answers
66
views
Given component holder class MainActivity does not implement interface GeneratedComponent or interface GeneratedComponentManager
im creating an app with hilt DI and jetpack compose and my app crashes, when i start it. There are parts of code,where i use hilt:
@Module
@InstallIn(SingletonComponent::class)
object AppModule {
@...
0
votes
2
answers
67
views
Execution failed for task app:kaptDebugKotlin after updating firebase crashlytics, analytics and kotlin
Thanks in advance, My problem is that after upgrading the Firebase Crashlytics, Analytics dependencies using firebase-bom:32.2.2 and kotlin version also (from 1.5.21 to 1.8.0), My project got broken ...
5
votes
1
answer
618
views
Migrating dagger from kapt to ksp
last time I tried to migrate from kapt to ksp, all libraries with no problem instead of dagger...
see libraries
dagger2_version '2.47'
I got the error logs:
e: [ksp] Cannot use legacy dagger.spi....
0
votes
1
answer
66
views
Dagger and Multiple AWS Lambdas
I am trying to use Java + Dagger to create a few basic lambdas to handle API Gateway requests.
I am trying to use Dagger to inject the AWS clients the different functions will need, but am struggling ...
0
votes
0
answers
33
views
Dagger Circular Dependency Deadlock
Is it possible for Dagger to deadlock while providing for dependencies? For example, there is a circular dependency between Class A and Class B because both inject each other like this:
class ClassA @...
2
votes
0
answers
83
views
NoClassDefFoundError for singleton in dagger hilt
I have an abstract class
abstract class AccessEnablerDelegate : IAccessEnablerDelegate {}
Using dagger over another class for singleton
@Singleton
class AdobePassAuthentication @Inject constructor(@...
0
votes
1
answer
148
views
How to share ViewModel and its scope across fragments?
I have a small app where one ViewModel has been shared between Fragment and FragmentDialog. It shares not only logic, but also a state. It works fine until I have added one more fragment which uses ...
0
votes
1
answer
368
views
How to fix incompatibility between kapt, Java's and Kotlin's versions, using Dagger?
I have one problem in my Android project. I discovered this error:
compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' task (current target is 17) jvm target ...
0
votes
0
answers
41
views
Dagger/MissingBinding androidx.lifecycle.ViewModelProvider cannot be provided without an @Inject constructor or an @Provides-annotated method
How can I solve this problem, I know there are some issues by ViewModelProvider, but I can't solve it while googling. But, maybe different errors cause this bug
Complete error is like this:
D:\coding\...
0
votes
1
answer
140
views
Android ActivityViewModels - what happens when activity is destroyed
I am trying to understand a bit of a scenario where we have a viewmodel created using ktx-library extension activityViewModels.
I understood that it can be used by fragments that wants to share ...
1
vote
0
answers
48
views
How to prevent DependencyCycle?
After added to refreshToken I get this error. It make problem because of using a method of AuthsRepository in TokenAuthenticator class. When I removed to using authsRepository that's not make problem. ...
1
vote
2
answers
74
views
Hilt - Fatal Exception when passing object into ViewModel
I am updating my app to use Hilt but am seeing a crash when passing a value into my viewmodel.
MainActivity
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(...
0
votes
0
answers
72
views
App crashes after adding AuthInterceptor to Apollo client
my app crashes after adding AuthInterceptor to the Apollo client and I can't seem to figure out why it crashes.
ERROR:
E FATAL EXCEPTION: main ...
0
votes
0
answers
24
views
error: incompatible types: Class<SplashViewModel> cannot be converted to Class<? extends NonExistentClass>
I have an error " incompatible types: Class cannot be converted to Class<? extends NonExistentClass> "
Mb someone had the same problem
what i've got during compilation
I think ...
0
votes
1
answer
59
views
Hilt injection is null
I try to use HIlt injection but the injectet object is null
have all dependencies:
app/build.gradle
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.dagger.hilt.android'
dependencies {
...
0
votes
0
answers
41
views
Provide hilt and dagger injection in one class. Hilt and dagger in one project
I have main DI as dagger framework, but some implementation made by Hilt framework.
But I need to use in one class Injections which made from both framework.
public class MainActivity{
@Inject
...
0
votes
0
answers
40
views
Cannot be provided without an @provides-annotated method for migration from dagger to hilt
Please help me with such error.
I'm trying to use dagger and hilt in one project.
DataSource eas using a dagger, but I want to implement hilt for use.
And hilt shows an error cannot be provided ...
0
votes
1
answer
36
views
Dagger injected singleton is reverting to default value when OS initiates process death
I just want to understand if this (title) is normal behavior or if I have implemented dagger injection incorrectly? The steps I am taking to reproduce this bug is
background app
terminate process ...
0
votes
1
answer
19
views
Problem following dagger tutorial, section 10 doesn't even compile
I have been trying to follow this tutorial:
https://dagger.dev/tutorial
But I have found several problems with it. The first problems occurs in the section https://dagger.dev/tutorial/01-setup, here ...
0
votes
0
answers
25
views
Exception by migration from dagger to hilt
I have exception
Exception is:
Caused by: java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract java.lang.Iterable initSteps()' of abstract class dagger.shaded.auto.common....
1
vote
2
answers
126
views
How to pass activity context in my ViewModel class?
I am making an app with firebase authentication that uses signInWithEmailAndPassword() to authenticate the users. Now I also need the activity context with signInWithEmailAndPassword(). So, how do I ...
0
votes
0
answers
51
views
Dagger Component is not created
Im using Hedgehog latest version with gradle 8 and kotlin gradle files.
I have AppComponent interface:
@Component
interface AppComponent {
@Component.Builder
interface Builder{
fun ...
0
votes
1
answer
309
views
Dagger 2 Inject Dependency from custom scope inside my viewmodel
I am trying to create a custom scope for some of my objects, to use them in viewmodels and other places withing my app that do not belong in this scope.
This is what my component and subcomponent look ...
0
votes
1
answer
87
views
Is it possible to use Dagger components and modules from production code when writing Android UI Tests?
I have large android application with lots of library modules and dagger components, and I need to write Android UI tests for them. I don't want to create every single dagger component for each module....
1
vote
0
answers
51
views
After setting up Dagger-Hilt, several packages are created
packages image After setting up Dagger-Hilt, several packages are created, including:
dagger.hilt.internal.aggregatedroot.codegen:
hilt_aggregated_deps:
To avoid these packages, what should I do? ...
-3
votes
1
answer
2k
views
Class handler.GameSessionLambda has no public zero-argument constructor: java.lang.Exception [closed]
I'm working with Lambda in Java and added Dagger2. However I'm having problem injecting objects to my lambda handler.
I'm getting the following error:
enter image description here
Class handler....
0
votes
0
answers
141
views
How to add kapt for local .jar files in KMM project
I am trying to add local .jar files in my KMM project and trying to access with kapt annotation processor. but getting error for following
Unresolved reference : DaggerAppComponent
kapt(files("\...
0
votes
1
answer
215
views
Unresolved reference DaggerAppComponent in Kotlin
Unable to resolve reference DaggerAppComponent and CoreInjectHelper in the below code:
DaggerAppComponent.builder()
.coreComponent(CoreInjectHelper.provideCoreComponent(this))
...
0
votes
0
answers
88
views
How to add hilt dependency in sub module attach it to main module
Hi anyone help solve this issue submodule has Hilt dependency. I wanted to add to main module getting this error
Application class annotated with @HiltAndroidApp has to be defined in an android ...