3,189 questions
1
vote
0
answers
88
views
Unable to setup Kapt for dagger in kotlin multiplatform
I'm trying to set up Dagger in a Kotlin Multiplatform module for Android only as a POC for a migration of a project.
Therefore, I needed to set up kapt and followed the instructions in Kmp in Kapt ...
0
votes
1
answer
52
views
Problem dagger with module and component in different libraries
I want to understand how it works.
I have application with three libraries:
:main
:module1
:module2
:di_api
Library :main:
build.gradle.kts:
dependencies {
implementationProjects(
":...
0
votes
0
answers
46
views
Dagger-dsl, [ksp] java.lang.IllegalArgumentException: Provides method must have a type parameter
I use framework, https://github.com/AntonButov/dagger-dsl.
@DaggerDsl
val di = component<Component> {
provides {
Provides()
}
bind<Bind,...
0
votes
0
answers
50
views
Using Room Database with Dagger 2 and multi-module project
I have the following project structure:
app/
di/
components/
modules
JakcApplication.kt
MainActivity.kt
core/
data/
local/
database/
...
0
votes
1
answer
84
views
How to create two objects in Dagger Hilt with different life scopes?
I have a repository that should be Singletone as it holds state inside it. I provide it like this:
@Module
@InstallIn(SingletonComponent::class)
object RepoModule {
@Provides
fun ...
0
votes
0
answers
49
views
In Singleton lateinit property packageInfoData has not been initialized
I am an Android Developer.
I want to use Singelton with dagger hilt 2, I am using Jetpack Compose.
This is my code right now:
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class ...
1
vote
0
answers
649
views
Dagger 2.52 to use jakarta for the generated code
I have the following dagger 2.52 dependency in my project:
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2....
0
votes
1
answer
80
views
Android Test cannot execute Fragment instrumented tests with Dagger provided ViewModel, hitting NullPointerException on ViewModelProvider param owner
I have a fragment whose instance of ViewModel is provided by a component, scoped to the navigation graph of Main Activity. The Dagger app component was injected into the single Main Activity and ...
1
vote
1
answer
230
views
Is Hilt uses alpha version of Dagger’s KSP support under the hood?
In official Dagger documentation said:
Warning: Dagger’s KSP support is currently in alpha.
In Hilt release notes said:
Add KSP support to androidx.hilt.
So, my question is: is Hilt uses alpha ...
0
votes
1
answer
43
views
Injecting fragment's data into viewmodel using dagger2
I have a FooViewModel that is scoped to the FooFragment. In FooFragment, the device type is passed from another fragment based on what user selects. I want to inject this in the constructor of the ...
0
votes
1
answer
504
views
Hilt SingletonComponent vs ActivityComponent scope
I have an app with three activities.
Launch Activity A -> Activity B -> Activity -> C
Previous activity is finished while navigating to next activity.
I am injecting objects in Activity A and ...
-1
votes
2
answers
334
views
Mockito inject some mock objects and some real objects
I'm testing a function like this:
public class CsvUtilsTest {
@Mock
private S3Client s3Client;
@Mock
private S3BucketWrapper s3Buckets;
@Mock
CsvMapper csvMapper;
@...
-1
votes
1
answer
126
views
How to inject some but not all parameters
In my team's codebase I see classes that either have all parameters injected (and no constructor arguments) or have nothing injected. However, I'm wondering how to have a class with some injected and ...
0
votes
1
answer
126
views
Dagger2 injection across modules replace implementation of Interface
I am breaking up my project into different Android Studio modules. At the base, I have a headless modules with core business logic. Down the module dependency tree, I have an app modules that ...
0
votes
1
answer
60
views
Does Using ActivityComponent Scope in Hilt Provide the Same Dependency Instance Across All Fragments in the Activity
As we can see in the attached picture from the Google website,
The SingletonComponent will provide the same dependency instance across the application.
Is this the same for ActivityComponent? Will it ...