Android gradle instrument test module does not see sources from main project

Over the past few days, I have been struggling with creating a separate test module in the gradle project for Android. I learned how to set up test tests inside my main project in the instrumentationTest directory, but I can’t find a way to do this in the new module. My test module does not see sources from my main project.

This is the project structure:

MyProject/
 | settings.gradle
 + MainApp/
    | build.gradle
    | src/main/java/...
    | res
 + MainAppFunctionalTests/
    | build.gradle
    | src/instrumentTest/java/...

In my .gradle settings I have:

include ':MainApp', 'MainAppFunctionalTests'

In MainAppFunctionalTests build.gradle I set:

compile project(':MainApp')

but my test project still does not see sources from my main project. I do not want to have functional tests in the main project, because I would like to conduct unit tests there using Robolectric.

I will be happy for any help.

+4
1

, project() , .

gradle MainApp:androidDependencies

.

apk .

: assembleTest apk, apk

0

All Articles