3

I have the annoying issue with Android Studio 2.0 beta 6.

I have multi-module project. And tests in one module (backend) are not compilable by Android Studio because it can not find references to classes from another module that it depends on:

screenshot

Everything is fine when I run gradle.

UPDATE

With Android Studio 1.5 I was able to run tests from all modules separately. I will investigate how to run all tests how it was before we were having flavours.

UPDATE 2

If I try to run unit tests from AS than I see classpath which includes:

**/core/build/intermediates/classes/test/debug

but doesn't include:

**/core/build/intermediates/classes/debug

Where are classes that missed right now

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114
  • What about icpclient? – tiny sunlight Mar 09 '16 at 13:56
  • Do you use `androidTestCompile` in your gradle file? check this link http://stackoverflow.com/questions/16637608/specifying-test-dependencies-with-the-gradle-android-build-system it maybe helpful for you – Volodymyr Mar 09 '16 at 14:03
  • @tinysunlight **icpClient** is fine since it doesn't have sources. This module is there only to wrap some dependency that is not distributed over maven repository – Eugen Martynov Mar 09 '16 at 14:05
  • @vovaxo, I use plain unit tests. The answer is three years old from times when AS was not supporting unit tests on jvm – Eugen Martynov Mar 09 '16 at 14:05
  • I don't really understand what you said.But I think you can try to clearcache and restart and put more clues. – tiny sunlight Mar 09 '16 at 14:12
  • @tinysunlight I mean **icpClient** doesn't have own sources. It is just module that keeps jar and so files. There is nothing to import – Eugen Martynov Mar 09 '16 at 14:14
  • Can you open a file in library core and create a screenshot of directory structure of library core? – tiny sunlight Mar 09 '16 at 14:17
  • @tinysunlight if you're asking me to check if the file is there and AS understand it as project file then the answer is yes. I also updated the question – Eugen Martynov Mar 09 '16 at 14:19
  • Do you use sourceset in build.gradle?I mean that default path maybe not same in different Android Studio Version. – tiny sunlight Mar 09 '16 at 14:23
  • 1
    No, we don't use any `sourceset` definition. As reminder it also perfectly fine works from command line – Eugen Martynov Mar 09 '16 at 14:25

1 Answers1

2

We had this same issue for modules in our project that had unit tests. They all ran fine with the command line, but had this issue in Android Studio. We finally determined it's a bug with the newest version of Android Studio. The work around is to disable the "Experimental" test feature.

enter image description here

Hopefully they'll fix this in newer versions, but it's affecting us in Android Studio 2.0 beta 6.

Related Answer: Test Artifact selector missing/gone from Build Variants in Android Studio 2 Beta 5

Community
  • 1
  • 1
Sam Edwards
  • 874
  • 8
  • 19