Skip to content

Unable to use @TestInstallIn in java-library module since it's a part of Android artifact (aar) #3196

Open
@plnice

Description

@plnice

In my Android project I have a Gradle java-library module which I use to provide a utility class that doesn't need a dependency on Android SDK. The module contains the interface for the utility, internal implementation class and the Hilt module with @InstallIn(SingletonComponent::class) annotation that binds the implementation to the interface; it has dependency on hilt-core java-only artifact.

What I want to do is to add testFixtures source set to the module and within it create test implementation and test module annotated with @TestInstallIn. However, @TestInstallIn annotation is provided as a part of hilt-android-testing artifact, which is an Android artifact (aar). Therefore I cannot attach it to the java-library project.

What I'd expect is to have another dependency, let's say hilt-core-testing, that only provides the @TestInstallIn annotation, and the dependency is served as a jar.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions