Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

FakeStorage unresolved reference on TestStorageModule #78

@reisfernanda

Description

@reisfernanda

TestStorageModule from androidTest shows an unresolved reference error for FakeStorage on the solution branch, even though the instrumented tests run successfully.
FakeStorage is located at the sharedTest package, and this package is shared with tests through sourceSets, but it looks like sharing code this way is not supported anymore, according to this comment on Google Issue Tracker.

sourceSets {
        String sharedTestDir = 'src/sharedTest/java'
        test {
            java.srcDir sharedTestDir
        }
        androidTest {
            java.srcDir sharedTestDir
        }

    }

A suggestion found on the same comment on Google Issue Tracker is to create a new module with the code that needs to be shared and add it as a dependency for testImplementation and androidTestImplementation.

testImplementation project(path: ':shared-test')
androidTestImplementation project(path: ':shared-test') 

Android Studio version:

Android Studio Giraffe | 2022.3.1 Patch 2
Build #AI-223.8836.35.2231.10811636, built on September 14, 2023

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions