1

Steps I have done to solve the problem:

1) build.gradle: sourceSets { androidTest { java.srcDirs = ['androidTest/java'] } }

2) Run - Edit configuration - + Android Tests - add new configuration (All in Module, Specific instrumentation runner (optional) - android.support.test.runner.AndroidJUnitRunner, Target - Emulator).

3) Sync Project with Gradle files.

4) Build Variants - Android Instrumentation Tests.

But the folder androidTest/java doesn't change the color. And I cannot add class test.

How can I overcome this?

1 Answer 1

1

Try using:

sourceSets {
    main {
        assets.srcDirs = ['assets', 'src/main/assets', 'src/main/assets/fonts']
        java.srcDirs = ['src/main/java', 'src/instrumentTest', 'src/instrumentTest/java', 'src/test/java', 'androidTest/java']
    }
    test {
        java.srcDirs = ['androidTest/java', 'src/test/java', 'src/test/java/']
        resources.srcDirs = ['src/test/resources']
    }
}

Let me know if it doesn't change the color

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.